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

failed to get context for in-cluster kube config: open /var/run/secrets/kubernetes.io/serviceaccount/token: no such file or directory #1326

Open
13567436138 opened this issue Sep 3, 2024 · 0 comments

Comments

@13567436138
Copy link

What happend:

  Warning  FailedCreatePodSandBox  0s    kubelet            Failed to create pod sandbox: rpc error: code = Unknown desc = failed to setup network for sandbox "259428c225183e265d4f994c2064eecda1bcc6b8679666a2da1f155d0a406340": plugin type="multus-shim" name="multus-cni-network" failed (add): CmdAdd (shim): CNI request failed with status 400: 'ContainerID:"259428c225183e265d4f994c2064eecda1bcc6b8679666a2da1f155d0a406340" Netns:"/var/run/netns/cni-10ba9733-eff2-c375-6bd4-460b96e709ae" IfName:"eth0" Args:"K8S_POD_NAMESPACE=default;K8S_POD_NAME=samplepod;K8S_POD_INFRA_CONTAINER_ID=259428c225183e265d4f994c2064eecda1bcc6b8679666a2da1f155d0a406340;K8S_POD_UID=4caa22fb-5095-44d1-9102-4f54223f6616;IgnoreUnknown=1" Path:"" ERRORED: error configuring pod [default/samplepod] networking: [default/samplepod/4caa22fb-5095-44d1-9102-4f54223f6616:multus-config]: error adding container to network "multus-config": Multus: error getting k8s client: GetK8sClient: failed to get context for in-cluster kube config: open /var/run/secrets/kubernetes.io/serviceaccount/token: no such file or directory
': StdinData: {"capabilities":{"bandwidth":true,"portMappings":true},"clusterNetwork":"/host/etc/cni/net.d/10-calico.conflist","cniVersion":"0.3.1","logLevel":"verbose","logToStderr":true,"name":"multus-cni-network","type":"multus-shim"}
cat <<EOF | kubectl apply -f -
apiVersion: "k8s.cni.cncf.io/v1"
kind: NetworkAttachmentDefinition
metadata:
  name: multus-config
spec:
  config: '{
    "cniVersion": "0.3.1",
    "name": "multus-config",
    "type": "multus",
    "delegates": [
      {
        "cniVersion": "0.3.1",
        "name": "macvlan-ipv4",
        "type": "macvlan",
        "master": "ens33",
        "ipam": {
          "type": "host-local",
          "subnet": "192.168.1.0/24",
          "rangeStart": "192.168.1.10",
          "rangeEnd": "192.168.1.20",
          "routes": [
            { "dst": "0.0.0.0/0" }
          ]
        }
      },
      {
        "cniVersion": "0.3.1",
        "name": "macvlan-ipv6",
        "type": "macvlan",
        "master": "ens33",
        "ipam": {
          "type": "host-local",
          "subnet": "fd00::/64",
          "rangeStart": "fd00::10",
          "rangeEnd": "fd00::20",
          "routes": [
            { "dst": "::/0" }
          ]
        }
      }
    ]
   }'
EOF
cat <<EOF | kubectl create -f -
apiVersion: v1
kind: Pod
metadata:
  name: samplepod
  annotations:
    k8s.v1.cni.cncf.io/networks: multus-config
spec:
  containers:
    - name: nginx-container
      image: nginx:latest
      ports:
        - containerPort: 80
      volumeMounts:
        - name: nginx-storage
          mountPath: /usr/share/nginx/html
  volumes:
    - name: nginx-storage
      emptyDir: {}
EOF

What you expected to happen:

How to reproduce it (as minimally and precisely as possible):

Anything else we need to know?:

Environment:

  • Multus version
    install using kubectl apply -f https://raw.githubusercontent.com/k8snetworkplumbingwg/multus-cni/master/deployments/multus-daemonset-thick.yml
    image path and image ID (from 'docker images')

  • Kubernetes version (use kubectl version):1.31.0

  • Primary CNI for Kubernetes cluster: calico

  • OS (e.g. from /etc/os-release):ubuntu 2404

  • File of '/etc/cni/net.d/'
    root@k8s-master01:~# ls /etc/cni/net.d/
    00-multus.conf 10-calico.conflist 10-containerd-net.conflist calico-kubeconfig

  • File of '/etc/cni/multus/net.d'
    root@k8s-master01:~# ls /etc/cni/multus/net.d
    ls: cannot access '/etc/cni/multus/net.d': No such file or directory

  • NetworkAttachment info (use kubectl get net-attach-def -o yaml)

  • Target pod yaml info (with annotation, use kubectl get pod <podname> -o yaml)

  • Other log outputs (if you use multus logging)

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

1 participant