lyft / cni-ipvlan-vpc-k8s

AWS VPC Kubernetes CNI driver using IPvlan
Apache License 2.0
360 stars 58 forks source link

Error adding network: no plugin name provided #7

Closed liwenwu-amazon closed 6 years ago

liwenwu-amazon commented 6 years ago

Thanks for sharing the great work. I am trying to test it out but was not able to bring up following pods

kubectl create -f https://k8s.io/docs/tasks/access-application-cluster/hello.yaml

I am using version 1.7.10

kubectl version
Client Version: version.Info{Major:"1", Minor:"6", GitVersion:"v1.6.4", GitCommit:"d6f433224538d4f9ca2f7ae19b252e6fcb66a3ae", GitTreeState:"clean", BuildDate:"2017-05-19T18:44:27Z", GoVersion:"go1.7.5", Compiler:"gc", Platform:"linux/amd64"}
Server Version: version.Info{Major:"1", Minor:"7", GitVersion:"v1.7.10", GitCommit:"bebdeb749f1fa3da9e1312c4b08e439c404b3136", GitTreeState:"clean", BuildDate:"2017-11-03T16:31:49Z", GoVersion:"go1.8.3", Compiler:"gc", Platform:"linux/amd64"}

I am seeing following error in the log file:

kubelet[3752]: E1212 21:12:29.218496    3752 cni.go:294] Error adding network: no plugin name provided

I am using the configuration file provided in README and have updated it with my secGroupIds

{
  "cniVersion": "0.3.1",
  "name": "cni-ipvlan-vpc-k8s",
  "plugins": [
  {
      "cniVersion": "0.3.1",
      "type": "cni-ipvlan-vpc-k8s-ipvlan",
      "mode": "l2",
      "master": "ipam",
      "ipam": {
          "type": "cni-ipvlan-vpc-k8s-ipam",
          "interfaceIndex": 1,
              "subnetTags": {
              "kubernetes_kubelet": "true"
          },
          "secGroupIds": [
              "sg-34b79141"
              ]
          }
    },
    {
        "cniVersion": "0.3.1",
        "type": "cni-ipvlan-vpc-k8s-unnumbered-ptp",
        "hostInterface": "eth0",
        "containerInterface": "veth0",
        "ipMasq": true
    }
    ]
}

Here are cni binaries in /opt/cni/bin:

root@ip-10-0-55-131:/opt/cni/bin# ls
bridge           cni-ipvlan-vpc-k8s-ipvlan   cni-ipvlan-vpc-k8s-tool        flannel     loopback
cni-ipvlan-vpc-k8s-ipam  cni-ipvlan-vpc-k8s-.tar.gz  cni-ipvlan-vpc-k8s-unnumbered-ptp  host-local  ptp

Here is the code snippet

~/workspace/src/k8s-v1.7.10/kubernetes-1.7.10/vendor/github.com/containernetworking/cni/pkg/invoke/find.go
// FindInPath returns the full path of the plugin by searching in the provided path
func FindInPath(plugin string, paths []string) (string, error) {
        if plugin == "" {
                return "", fmt.Errorf("no plugin name provided")
        }

        if len(paths) == 0 {
                return "", fmt.Errorf("no paths provided")
        }       

        for _, path := range paths {
                for _, fe := range ExecutableFileExtensions {
                        fullpath := filepath.Join(path, plugin) + fe
                        if fi, err := os.Stat(fullpath); err == nil && fi.Mode().IsRegular() {
                                return fullpath, nil
                        }
                }
        }               

        return "", fmt.Errorf("failed to find plugin %q in path %s", plugin, paths)
}

Kubelet is running with following options:

root      3752     1  1 21:07 ?        00:00:30 /usr/local/bin/kubelet --node-ip --allow-privileged=true --cgroup-root=/ --cloud-provider=aws --cluster-dns=100.64.0.10 --cluster-domain=cluster.local --enable-debugging-handlers=true --eviction-hard=memory.available<100Mi,nodefs.available<10%,nodefs.inodesFree<5%,imagefs.available<10%,imagefs.inodesFree<5% --hostname-override=ip-10-0-55-131.ec2.internal --kubeconfig=/var/lib/kubelet/kubeconfig --network-plugin=cni --node-labels=kubernetes.io/role=node,node-role.kubernetes.io/node= --non-masquerade-cidr=100.64.0.0/10 --pod-manifest-path=/etc/kubernetes/manifests --register-schedulable=true --require-kubeconfig=true --v=2 --cni-bin-dir=/opt/cni/bin/ --cni-conf-dir=/etc/cni/net.d/

Can you tell me if I missed anything?

thank you very much

paulnivin commented 6 years ago

what files are in /etc/cni/net.d/?

liwenwu-amazon commented 6 years ago

Here is what I have:

root@ip-10-0-55-131:/home/admin# cd /etc/cni/net.d/
root@ip-10-0-55-131:/etc/cni/net.d# ls
lyft.conf
root@ip-10-0-55-131:/etc/cni/net.d# cat lyft.conf
{
  "cniVersion": "0.3.1",
  "name": "cni-ipvlan-vpc-k8s",
  "plugins": [
  {
      "cniVersion": "0.3.1",
      "type": "cni-ipvlan-vpc-k8s-ipvlan",
      "mode": "l2",
      "master": "ipam",
      "ipam": {
          "type": "cni-ipvlan-vpc-k8s-ipam",
          "interfaceIndex": 1,
          "subnetTags": {
          "kubernetes_kubelet": "true"
      },
      "secGroupIds": [
          "sg-34b79141"
          ]
          }
    },
    {
        "cniVersion": "0.3.1",
        "type": "cni-ipvlan-vpc-k8s-unnumbered-ptp",
        "hostInterface": "eth0",
        "containerInterface": "veth0",
        "ipMasq": true
    }
    ]
}

thanks

paulnivin commented 6 years ago

Rename lyft.conf to lyft.conflist and it should start working. .conflist is used for chained plugins.

liwenwu-amazon commented 6 years ago

Thank you! It works for me now.

ylhyh commented 4 years ago

Faced the same issue, then get resolved by download latest plugin version from "https://github.com/containernetworking/plugins/releases"