Skip to content

Commit 2538bea

Browse files
authored
fix(cluster): pass resolv-conf as kubelet arg and pin k3s image digest (#701)
1 parent 0eebbc8 commit 2538bea

File tree

3 files changed

+16
-5
lines changed

3 files changed

+16
-5
lines changed

architecture/gateway-single-node.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -260,7 +260,7 @@ On Docker custom networks, `/etc/resolv.conf` contains `127.0.0.11` (Docker's in
260260
2. Getting the container's `eth0` IP as a routable address.
261261
3. Adding DNAT rules in PREROUTING to forward DNS from pod namespaces through to Docker's DNS.
262262
4. Writing a custom resolv.conf pointing to the container IP.
263-
5. Passing `--resolv-conf=/etc/rancher/k3s/resolv.conf` to k3s.
263+
5. Passing `--kubelet-arg=resolv-conf=/etc/rancher/k3s/resolv.conf` to k3s.
264264

265265
Falls back to `8.8.8.8` / `8.8.4.4` if iptables detection fails.
266266

deploy/docker/Dockerfile.images

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,11 @@
1212
# supervisor-builder Release openshell-sandbox binary
1313
# supervisor-output Minimal stage exporting only the supervisor binary
1414

15+
# Pin by tag AND manifest-list digest to prevent silent upstream republishes
16+
# from breaking the build. Update both when bumping k3s versions.
17+
# To refresh: docker buildx imagetools inspect rancher/k3s:<tag> | head -3
1518
ARG K3S_VERSION=v1.35.2-k3s1
19+
ARG K3S_DIGEST=sha256:c3184157c3048112bab0c3e17405991da486cb3413511eba23f7650efd70776b
1620
ARG K9S_VERSION=v0.50.18
1721
ARG HELM_VERSION=v3.17.3
1822
ARG NVIDIA_CONTAINER_TOOLKIT_VERSION=1.18.2-1
@@ -181,7 +185,7 @@ CMD ["--port", "8080"]
181185
# ---------------------------------------------------------------------------
182186
# Cluster asset stages
183187
# ---------------------------------------------------------------------------
184-
FROM rancher/k3s:${K3S_VERSION} AS k3s
188+
FROM rancher/k3s:${K3S_VERSION}@${K3S_DIGEST} AS k3s
185189

186190
FROM ubuntu:24.04 AS k9s
187191
ARG K9S_VERSION
@@ -262,6 +266,11 @@ COPY deploy/kube/manifests/*.yaml /opt/openshell/manifests/
262266
COPY deploy/kube/gpu-manifests/*.yaml /opt/openshell/gpu-manifests/
263267

264268
ENTRYPOINT ["/usr/local/bin/cluster-entrypoint.sh"]
269+
# Default to "server" so bare `docker run <image>` works without requiring
270+
# the caller to pass a subcommand. The openshell CLI already passes
271+
# ["server", "--disable=traefik", ...] as CMD; this default only affects
272+
# manual `docker run` invocations that omit a command.
273+
CMD ["server"]
265274

266275
HEALTHCHECK --interval=5s --timeout=5s --start-period=20s --retries=60 \
267276
CMD ["/usr/local/bin/cluster-healthcheck.sh"]

deploy/docker/cluster-entrypoint.sh

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
# embedded DNS resolver at 127.0.0.11. Docker's DNS listens on random high
1919
# ports (visible in the DOCKER_OUTPUT iptables chain), so we parse those ports
2020
# and set up DNAT rules to forward DNS traffic from k3s pods. We then point
21-
# k3s's --resolv-conf at the container's routable eth0 IP.
21+
# k3s's resolv-conf kubelet arg at the container's routable eth0 IP.
2222
#
2323
# Per k3s docs: "Manually specified resolver configuration files are not
2424
# subject to viability checks."
@@ -562,6 +562,8 @@ fi
562562
# routing to settle first.
563563
wait_for_default_route
564564

565-
# Execute k3s with explicit resolv-conf.
565+
# Execute k3s with explicit resolv-conf passed as a kubelet arg.
566+
# k3s v1.35.2+ no longer accepts --resolv-conf as a top-level server flag;
567+
# it must be passed via --kubelet-arg instead.
566568
# shellcheck disable=SC2086
567-
exec /bin/k3s "$@" --resolv-conf="$RESOLV_CONF" $EXTRA_KUBELET_ARGS
569+
exec /bin/k3s "$@" --kubelet-arg=resolv-conf="$RESOLV_CONF" $EXTRA_KUBELET_ARGS

0 commit comments

Comments
 (0)