underpost 2.8.793 → 2.8.794
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/cli.md +1 -1
- package/docker-compose.yml +1 -1
- package/manifests/lxd/underpost-setup.sh +5 -31
- package/manifests/valkey/service.yaml +2 -8
- package/manifests/valkey/statefulset.yaml +5 -7
- package/package.json +1 -1
- package/src/cli/cluster.js +16 -11
- package/src/cli/deploy.js +19 -0
- package/src/index.js +1 -1
- package/src/server/logger.js +3 -3
package/README.md
CHANGED
package/cli.md
CHANGED
package/docker-compose.yml
CHANGED
|
@@ -53,7 +53,7 @@ echo "
|
|
|
53
53
|
██╗░░░██╗███╗░░██╗██████╗░███████╗██████╗░██████╗░░█████╗░░██████╗████████╗
|
|
54
54
|
██║░░░██║████╗░██║██╔══██╗██╔════╝██╔══██╗██╔══██╗██╔══██╗██╔════╝╚══██╔══╝
|
|
55
55
|
██║░░░██║██╔██╗██║██║░░██║█████╗░░██████╔╝██████╔╝██║░░██║╚█████╗░░░░██║░░░
|
|
56
|
-
|
|
56
|
+
██║░░░██║██║╚████║██║░░██║██╔══╝░░██╔══██╗██╔═══╝░██║░░██║░╚═══██╗░░░██║░░░
|
|
57
57
|
╚██████╔╝██║░╚███║██████╔╝███████╗██║░░██║██║░░░░░╚█████╔╝██████╔╝░░░██║░░░
|
|
58
58
|
░╚═════╝░╚═╝░░╚══╝╚═════╝░╚══════╝╚═╝░░╚═╝╚═╝░░░░░░╚════╝░╚═════╝░░░░╚═╝░░░
|
|
59
59
|
|
|
@@ -74,29 +74,6 @@ npm install -g underpost
|
|
|
74
74
|
echo "Loading br_netfilter kernel module..."
|
|
75
75
|
sudo modprobe br_netfilter
|
|
76
76
|
|
|
77
|
-
# --- Disable UFW (Crucial for Kubernetes) ---
|
|
78
|
-
# UFW conflicts with Kubernetes' iptables management. Disable it completely.
|
|
79
|
-
echo "Disabling UFW to prevent conflicts with Kubernetes..."
|
|
80
|
-
if sudo systemctl is-active --quiet ufw; then
|
|
81
|
-
sudo systemctl stop ufw
|
|
82
|
-
fi
|
|
83
|
-
if sudo systemctl is-enabled --quiet ufw; then
|
|
84
|
-
sudo systemctl disable ufw
|
|
85
|
-
fi
|
|
86
|
-
# Attempt to remove ufw package. dnf will handle if it's not installed.
|
|
87
|
-
echo "Attempting to remove ufw package..."
|
|
88
|
-
sudo dnf remove -y ufw
|
|
89
|
-
|
|
90
|
-
# --- Kubernetes Required Ports (Informational - not for UFW) ---
|
|
91
|
-
# These ports are opened by Kubernetes itself or are expected to be open
|
|
92
|
-
# by external firewalls. UFW is no longer managing them.
|
|
93
|
-
echo "Note: Kubernetes requires the following ports to be open (managed by K8s or external firewall):"
|
|
94
|
-
echo " - Control Plane: 6443/TCP (Kubernetes API), 2379-2380/TCP (etcd)"
|
|
95
|
-
echo " - Worker Nodes: 10250/TCP (Kubelet API), 30000-32767/TCP/UDP (NodePorts)"
|
|
96
|
-
echo " - CNI specific ports (e.g., Calico: 179/TCP, 4789/UDP; Flannel: 8472/UDP)"
|
|
97
|
-
echo " - SSH: 22/TCP"
|
|
98
|
-
echo " - HTTP/HTTPS: 80/TCP, 443/TCP (for Ingress/Load Balancers)"
|
|
99
|
-
|
|
100
77
|
# --- Initial Host Setup for Kubernetes Prerequisites ---
|
|
101
78
|
# This calls the initHost method in cluster.js to install Docker, Podman, Kind, Kubeadm, Helm.
|
|
102
79
|
echo "Running initial host setup for Kubernetes prerequisites..."
|
|
@@ -130,9 +107,8 @@ echo "USE_WORKER = $USE_WORKER"
|
|
|
130
107
|
|
|
131
108
|
# --- Kubernetes Cluster Initialization Logic ---
|
|
132
109
|
|
|
133
|
-
#
|
|
134
|
-
|
|
135
|
-
echo "Applying Kubernetes host configuration (SELinux, Containerd, Sysctl)..."
|
|
110
|
+
# Apply host configuration (SELinux, Containerd, Sysctl, and now firewalld disabling)
|
|
111
|
+
echo "Applying Kubernetes host configuration (SELinux, Containerd, Sysctl, Firewalld)..."
|
|
136
112
|
underpost cluster --config
|
|
137
113
|
|
|
138
114
|
if $USE_KUBEADM; then
|
|
@@ -144,21 +120,19 @@ if $USE_KUBEADM; then
|
|
|
144
120
|
# For a full automated setup, you'd typically pass the join token/command here.
|
|
145
121
|
# Example: underpost cluster --worker --join-command "kubeadm join ..."
|
|
146
122
|
# For now, this just runs the worker-specific config.
|
|
147
|
-
underpost cluster --worker
|
|
123
|
+
underpost cluster --worker
|
|
124
|
+
underpost cluster --chown
|
|
148
125
|
echo "Worker node setup initiated. You will need to manually join this worker to your control plane."
|
|
149
126
|
echo "On your control plane, run 'kubeadm token create --print-join-command' and execute the output here."
|
|
150
127
|
else
|
|
151
128
|
echo "Running control plane setup with kubeadm..."
|
|
152
129
|
# This will initialize the kubeadm control plane and install Calico
|
|
153
130
|
underpost cluster --kubeadm
|
|
154
|
-
# Ensure kubectl config is set up for the current user
|
|
155
|
-
underpost cluster --chown
|
|
156
131
|
echo "Kubeadm control plane initialized. Check cluster status with 'kubectl get nodes'."
|
|
157
132
|
fi
|
|
158
133
|
elif $USE_KIND; then
|
|
159
134
|
echo "Running control node with kind..."
|
|
160
135
|
underpost cluster
|
|
161
|
-
underpost cluster --chown
|
|
162
136
|
echo "Kind cluster initialized. Check cluster status with 'kubectl get nodes'."
|
|
163
137
|
else
|
|
164
138
|
echo "No specific cluster role (--kubeadm, --kind, --worker) specified. Please provide one."
|
|
@@ -1,17 +1,11 @@
|
|
|
1
|
-
---
|
|
2
1
|
apiVersion: v1
|
|
3
2
|
kind: Service
|
|
4
3
|
metadata:
|
|
5
4
|
name: service-valkey
|
|
6
5
|
namespace: default
|
|
7
6
|
spec:
|
|
7
|
+
selector:
|
|
8
|
+
app: service-valkey
|
|
8
9
|
ports:
|
|
9
10
|
- port: 6379
|
|
10
11
|
targetPort: 6379
|
|
11
|
-
selector:
|
|
12
|
-
app: service-valkey
|
|
13
|
-
ipFamilyPolicy: PreferDualStack
|
|
14
|
-
ipFamilies:
|
|
15
|
-
- IPv4
|
|
16
|
-
# - IPv6
|
|
17
|
-
type: ClusterIP
|
|
@@ -14,27 +14,25 @@ spec:
|
|
|
14
14
|
labels:
|
|
15
15
|
app: service-valkey
|
|
16
16
|
spec:
|
|
17
|
-
# Prevent automatic token mounting if you're not using the default ServiceAccount
|
|
18
17
|
automountServiceAccountToken: false
|
|
19
|
-
|
|
20
18
|
containers:
|
|
21
19
|
- name: service-valkey
|
|
22
20
|
image: docker.io/valkey/valkey:latest
|
|
23
21
|
imagePullPolicy: IfNotPresent
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
value: Europe/Zurich
|
|
22
|
+
command: ["valkey-server"]
|
|
23
|
+
args: ["--port", "6379"]
|
|
27
24
|
ports:
|
|
28
25
|
- containerPort: 6379
|
|
29
26
|
startupProbe:
|
|
30
27
|
tcpSocket:
|
|
31
28
|
port: 6379
|
|
32
|
-
failureThreshold: 30
|
|
33
29
|
periodSeconds: 5
|
|
34
30
|
timeoutSeconds: 5
|
|
31
|
+
failureThreshold: 30
|
|
35
32
|
livenessProbe:
|
|
36
33
|
tcpSocket:
|
|
37
34
|
port: 6379
|
|
38
|
-
|
|
35
|
+
initialDelaySeconds: 10
|
|
39
36
|
periodSeconds: 30
|
|
40
37
|
timeoutSeconds: 5
|
|
38
|
+
failureThreshold: 2
|
package/package.json
CHANGED
package/src/cli/cluster.js
CHANGED
|
@@ -41,10 +41,10 @@ class UnderpostCluster {
|
|
|
41
41
|
if (options.initHost === true) return UnderpostCluster.API.initHost();
|
|
42
42
|
|
|
43
43
|
// Applies general host configuration (SELinux, containerd, sysctl)
|
|
44
|
-
if (options.config === true) UnderpostCluster.API.config();
|
|
44
|
+
if (options.config === true) return UnderpostCluster.API.config();
|
|
45
45
|
|
|
46
46
|
// Sets up kubectl configuration for the current user
|
|
47
|
-
if (options.chown === true) UnderpostCluster.API.chown();
|
|
47
|
+
if (options.chown === true) return UnderpostCluster.API.chown();
|
|
48
48
|
|
|
49
49
|
const npmRoot = getNpmRootPath();
|
|
50
50
|
const underpostRoot = options?.dev === true ? '.' : `${npmRoot}/underpost`;
|
|
@@ -132,7 +132,6 @@ class UnderpostCluster {
|
|
|
132
132
|
logger.info('Initializing Kind cluster...');
|
|
133
133
|
if (options.full === true || options.dedicatedGpu === true) {
|
|
134
134
|
shellExec(`cd ${underpostRoot}/manifests && kind create cluster --config kind-config-cuda.yaml`);
|
|
135
|
-
UnderpostCluster.API.chown();
|
|
136
135
|
} else {
|
|
137
136
|
shellExec(
|
|
138
137
|
`cd ${underpostRoot}/manifests && kind create cluster --config kind-config${
|
|
@@ -140,6 +139,7 @@ class UnderpostCluster {
|
|
|
140
139
|
}.yaml`,
|
|
141
140
|
);
|
|
142
141
|
}
|
|
142
|
+
UnderpostCluster.API.chown();
|
|
143
143
|
}
|
|
144
144
|
} else if (options.worker === true) {
|
|
145
145
|
// Worker node specific configuration (kubeadm join command needs to be executed separately)
|
|
@@ -327,15 +327,20 @@ class UnderpostCluster {
|
|
|
327
327
|
|
|
328
328
|
// Enable bridge-nf-call-iptables for Kubernetes networking
|
|
329
329
|
// This ensures traffic through Linux bridges is processed by iptables (crucial for CNI)
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
330
|
+
for (const iptableConfPath of [
|
|
331
|
+
`/etc/sysctl.d/k8s.conf`,
|
|
332
|
+
`/etc/sysctl.d/99-k8s-ipforward.conf`,
|
|
333
|
+
`/etc/sysctl.d/99-k8s.conf`,
|
|
334
|
+
])
|
|
335
|
+
shellExec(`echo 'net.bridge.bridge-nf-call-iptables = 1
|
|
336
|
+
net.bridge.bridge-nf-call-ip6tables = 1
|
|
337
|
+
net.bridge.bridge-nf-call-arptables = 1
|
|
338
|
+
net.ipv4.ip_forward = 1' | sudo tee ${iptableConfPath}`);
|
|
334
339
|
shellExec(`sudo sysctl --system`); // Apply sysctl changes immediately
|
|
335
340
|
|
|
336
|
-
//
|
|
337
|
-
|
|
338
|
-
|
|
341
|
+
// Disable firewalld (common cause of network issues in Kubernetes)
|
|
342
|
+
shellExec(`sudo systemctl stop firewalld || true`); // Stop if running
|
|
343
|
+
shellExec(`sudo systemctl disable firewalld || true`); // Disable from starting on boot
|
|
339
344
|
},
|
|
340
345
|
|
|
341
346
|
/**
|
|
@@ -391,7 +396,7 @@ class UnderpostCluster {
|
|
|
391
396
|
// Re-configure Docker's default storage location (if desired).
|
|
392
397
|
shellExec('sudo mv /var/lib/docker /var/lib/docker~ || true'); // Use || true to prevent error if dir doesn't exist
|
|
393
398
|
shellExec('sudo mkdir -p /home/docker');
|
|
394
|
-
shellExec('sudo chmod
|
|
399
|
+
shellExec('sudo chmod 777 /home/docker');
|
|
395
400
|
shellExec('sudo ln -s /home/docker /var/lib/docker');
|
|
396
401
|
|
|
397
402
|
// Prune all unused Podman data.
|
package/src/cli/deploy.js
CHANGED
|
@@ -273,6 +273,25 @@ kubectl patch ippool default-ipv4-ippool --type='json' -p='[{"op": "replace", "p
|
|
|
273
273
|
kubectl patch ippool default-ipv4-ippool --type='json' -p='[{"op": "replace", "path": "/spec/cidr", "value": "192.168.0.0/24"}]'
|
|
274
274
|
sudo podman run --rm localhost/<image-name>:<image-version> <command>
|
|
275
275
|
kubectl get configmap kubelet-config -n kube-system -o yaml > kubelet-config.yaml
|
|
276
|
+
kubectl -n kube-system rollout restart daemonset kube-proxy
|
|
277
|
+
|
|
278
|
+
kubectl get EndpointSlice -o wide --all-namespaces -w
|
|
279
|
+
|
|
280
|
+
kubectl run --rm -it test-dns --image=busybox:latest --restart=Never -- /bin/sh -c "
|
|
281
|
+
nslookup kubernetes.default.svc.cluster.local;
|
|
282
|
+
nslookup mongodb-service.default.svc.cluster.local;
|
|
283
|
+
nslookup service-valkey.default.svc.cluster.local;
|
|
284
|
+
nc -vz mongodb-service 27017;
|
|
285
|
+
nc -vz service-valkey 6379;
|
|
286
|
+
echo exit code: \\\$?
|
|
287
|
+
"
|
|
288
|
+
|
|
289
|
+
kubectl apply -f - <<EOF
|
|
290
|
+
apiVersion: apps/v1
|
|
291
|
+
kind: StatefulSet
|
|
292
|
+
metadata:
|
|
293
|
+
name: ...
|
|
294
|
+
EOF
|
|
276
295
|
`);
|
|
277
296
|
if (deployList === 'dd' && fs.existsSync(`./engine-private/deploy/dd.router`))
|
|
278
297
|
deployList = fs.readFileSync(`./engine-private/deploy/dd.router`, 'utf8');
|
package/src/index.js
CHANGED
package/src/server/logger.js
CHANGED
|
@@ -176,7 +176,7 @@ const loggerMiddleware = (meta = { url: '' }) => {
|
|
|
176
176
|
);
|
|
177
177
|
};
|
|
178
178
|
|
|
179
|
-
const
|
|
179
|
+
const underpostASCII = () => `
|
|
180
180
|
|
|
181
181
|
██╗░░░██╗███╗░░██╗██████╗░███████╗██████╗░██████╗░░█████╗░░██████╗████████╗
|
|
182
182
|
██║░░░██║████╗░██║██╔══██╗██╔════╝██╔══██╗██╔══██╗██╔══██╗██╔════╝╚══██╔══╝
|
|
@@ -188,10 +188,10 @@ const underpostASCI = () => `
|
|
|
188
188
|
|
|
189
189
|
const actionInitLog = () =>
|
|
190
190
|
console.log(
|
|
191
|
-
|
|
191
|
+
underpostASCII() +
|
|
192
192
|
`
|
|
193
193
|
https://www.nexodev.org/docs
|
|
194
194
|
`,
|
|
195
195
|
);
|
|
196
196
|
|
|
197
|
-
export { loggerFactory, loggerMiddleware, setUpInfo,
|
|
197
|
+
export { loggerFactory, loggerMiddleware, setUpInfo, underpostASCII, actionInitLog };
|