Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

panic: open /var/run/secrets/kubernetes.io/serviceaccount/token: no such file or directory when starting static pod #830

Open
lacrosse1991 opened this issue Apr 22, 2024 · 1 comment

Comments

@lacrosse1991
Copy link

Describe the bug
When starting up kube-vip as a static pod for control plane HA, the kube-vip is unable to start due to a "panic: open /var/run/secrets/kubernetes.io/serviceaccount/token: no such file or directory when starting static pod" error
To Reproduce
Steps to reproduce the behavior:

  1. Initialize K3S cluster using the following command
    curl -sfL https://get.k3s.io | sh -s -
    --flannel-backend=none
    --disable-kube-proxy
    --disable servicelb
    --disable-network-policy
    --disable traefik
    --tls-san=10.0.100.2
    --cluster-init
  2. Execute KVVERSION='v0.7.2'
  3. export VIP=10.0.100.2
  4. export INTERFACE=lo
  5. Execute alias kube-vip="ctr image pull ghcr.io/kube-vip/kube-vip:$KVVERSION; ctr run --rm --net-host ghcr.io/kube-vip/kube-vip:$KVVERSION vip /kube-vip"
  6. Execute kube-vip manifest pod --interface $INTERFACE --address $VIP --controlplane --bgp --localAS 64500 --bgpRouterID 10.0.7.5 --bgppeers 10.0.7.4:65000::false,10.0.7.6:65000::false > kube-vip.yaml
  7. Copy pod manifest using: cp kube-vip.yaml /var/lib/rancher/k3s/agent/pod-manifests/
  8. run kubectl get pod -n kube-system to see pod erroring out

Expected behavior
After running the above commands, the kube-vip pod should start and connect to a router to support BGP load balancing
Screenshots
If applicable, add screenshots to help explain your problem.
Screenshot 2024-04-21 at 11 51 40 PM

Environment (please complete the following information):

  • OS/Distro: 6.1.0-18-amd64 Bare-Bones implementation #1 SMP PREEMPT_DYNAMIC Debian 6.1.76-1 (2024-02-01) x86_64 GNU/Linux
  • Kubernetes Version:
    Client Version: v1.29.3+k3s1
    Kustomize Version: v5.0.4-0.20230601165947-6ce0bf390ce3
    Server Version: v1.29.3+k3s1
  • Kube-vip Version: 0.8.0

Kube-vip.yaml:
`apiVersion: v1
kind: Pod
metadata:
creationTimestamp: null
name: kube-vip
namespace: kube-system
spec:
containers:

  • args:
    • manager
      env:
    • name: vip_arp
      value: "false"
    • name: port
      value: "6443"
    • name: vip_interface
      value: lo
    • name: vip_cidr
      value: "32"
    • name: dns_mode
      value: first
    • name: cp_enable
      value: "true"
    • name: cp_namespace
      value: kube-system
    • name: bgp_enable
      value: "true"
    • name: bgp_routerid
      value: 10.0.7.5
    • name: bgp_as
      value: "64500"
    • name: bgp_peeraddress
    • name: bgp_peerpass
    • name: bgp_peeras
      value: "65000"
    • name: bgp_peers
      value: 10.0.7.4:65000::false,10.0.7.6:65000::false
    • name: address
      value: 10.0.100.2
    • name: prometheus_server
      value: :2112
      image: ghcr.io/kube-vip/kube-vip:v0.7.2
      imagePullPolicy: Always
      name: kube-vip
      resources: {}
      securityContext:
      capabilities:
      add:
      • NET_ADMIN
      • NET_RAW
        volumeMounts:
    • mountPath: /etc/kubernetes/admin.conf
      name: kubeconfig
      hostAliases:
  • hostnames:
    • kubernetes
      ip: 127.0.0.1
      hostNetwork: true
      volumes:
  • hostPath:
    path: /etc/kubernetes/admin.conf
    name: kubeconfig
    status: {}`

Additional context
Add any other context about the problem here.

@kn3609571
Copy link

Please add an option --k8sConfigPath /etc/rancher/k3s/k3s.yaml at step 6.
This will replace hostPath setting for kubeconfig volume and allow kube-vip to communicate with k8s API.

Expected volumes section in output:

  volumes
  - hostPath:
      path: /etc/rancher/k3s/k3s.yaml
      name: kubeconfig

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants