Skip to content

Instantly share code, notes, and snippets.

@adduc
Last active January 27, 2025 22:34
Show Gist options
  • Save adduc/da9b06a6ebca216b96dda2db1c215c40 to your computer and use it in GitHub Desktop.
Save adduc/da9b06a6ebca216b96dda2db1c215c40 to your computer and use it in GitHub Desktop.
Fixing problem: k3s shows as a new node every time its recreated

Problem: k3s shows as a new node every time its recreated

Solution: Pass --node-name=example as parameter to the server or agent command.

 services:
   server:
     image: rancher/k3s:v1.32.0-k3s1
     command:
       - server
       - --disable=metrics-server
+      - --node-name=example
     tmpfs: [ /run, /var/run ]
     ulimits: { nproc: 65535, nofile: { soft: 65535, hard: 65535 } }
     privileged: true
     restart: unless-stopped
     environment:
     - K3S_TOKEN=example
     - K3S_KUBECONFIG_OUTPUT=/output/kubeconfig.yaml
     - K3S_KUBECONFIG_MODE=666
     volumes:
     - ./data/server/k3s:/var/lib/rancher/k3s
     - ./data/server/cni:/var/lib/cni
     - ./data/server/kubelt:/var/lib/kubelet
     - .:/output
     ports:
     - 6443:6443  # Kubernetes API Server
     - 80:80      # Ingress controller port 80
     - 443:443    # Ingress controller port 443
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment