origin icon indicating copy to clipboard operation
origin copied to clipboard

Error adding network for calico cni plugin

Open fengbeihong opened this issue 9 years ago • 4 comments

[provide a description of the issue]

Calico failed to add network to pod with the specific version in openshift-ansible 3.6.0

Version

[provide output of the openshift version or oc version command]

oc v3.6.0+c4dd4cf
kubernetes v1.6.1+5115d708d7
features: Basic-Auth GSSAPI Kerberos SPNEGO

Server https://master:8443
openshift v3.6.0+c4dd4cf
kubernetes v1.6.1+5115d708d7
Steps To Reproduce
  1. Configure openshift to use calico while installation
# cat  /etc/ansible/hosts
# Create an OSEv3 group that contains the masters and nodes groups
[OSEv3:children]
masters
nodes

# Set variables common for all OSEv3 hosts
[OSEv3:vars]
# SSH user, this user should allow ssh based auth without requiring a password
ansible_ssh_user=root

openshift_release=3.6.0
openshift_deployment_type=origin
containerized=false
os_firewall_use_firewalld=false

openshift_master_cluster_method=native
openshift_clock_enabled=true

openshift_master_identity_providers=[{'name': 'htpasswd_auth', 'login': 'true', 'challenge': 'true', 'kind': 'HTPasswdPasswordIdentityProvider', 'filename': '/etc/origin/master/htpasswd'}]

openshift_disable_check=memory_availability,disk_availability,docker_storage_driver,docker_storage,docker_image_availability

os_sdn_network_plugin_name=cni
openshift_use_calico=true
openshift_use_openshift_sdn=false

# host group for masters
[masters]
master

# host group for etcd
[etcd]
master

# host group for nodes, includes region info
[nodes]
master openshift_schedulable=true openshift_node_labels="{'region': 'infra', 'zone': 'default'}"
node1 openshift_schedulable=true openshift_node_labels="{'region': 'primary', 'zone': 'east'}"
  1. After installation complete, download file https://github.com/openshift/origin/blob/master/examples/hello-openshift/hello-pod.json

  2. oc create -f hello-pod.json

Current Result
10月 29 14:06:52 node2 origin-node[23831]: I1029 14:06:52.850202   23831 plugins.go:397] Calling network plugin cni to set up pod "hello-openshift_default"
10月 29 14:06:52 node2 origin-node[23831]: I1029 14:06:52.850917   23831 cni.go:282] Got netns path /proc/24188/ns/net
10月 29 14:06:52 node2 origin-node[23831]: I1029 14:06:52.850927   23831 cni.go:283] Using netns path default
10月 29 14:06:52 node2 origin-node[23831]: I1029 14:06:52.850935   23831 cni.go:254] About to run with conf.Network.Type=loopback
10月 29 14:06:52 node2 origin-node[23831]: I1029 14:06:52.851594   23831 manager.go:898] Added container: "/kubepods.slice/kubepods-besteffort.slice/kubepods-besteffort-podd5eaa63c_bc70_11e7_8966_001c42066040.slice/docker-19bb4492d286727521e2d5335fdc2721919f9edf855b4047c3da6e4c05b36b75.scope" (aliases: [k8s_POD_hello-openshift_default_d5eaa63c-bc70-11e7-8966-001c42066040_0 19bb4492d286727521e2d5335fdc2721919f9edf855b4047c3da6e4c05b36b75], namespace: "docker")
10月 29 14:06:52 node2 origin-node[23831]: I1029 14:06:52.852202   23831 handler.go:325] Added event &{/kubepods.slice/kubepods-besteffort.slice/kubepods-besteffort-podd5eaa63c_bc70_11e7_8966_001c42066040.slice/docker-19bb4492d286727521e2d5335fdc2721919f9edf855b4047c3da6e4c05b36b75.scope 2017-10-29 14:06:52.776344907 +0800 CST containerCreation {<nil>}}
10月 29 14:06:52 node2 origin-node[23831]: I1029 14:06:52.852269   23831 container.go:407] Start housekeeping for container "/kubepods.slice/kubepods-besteffort.slice/kubepods-besteffort-podd5eaa63c_bc70_11e7_8966_001c42066040.slice/docker-19bb4492d286727521e2d5335fdc2721919f9edf855b4047c3da6e4c05b36b75.scope"
10月 29 14:06:52 node2 origin-node[23831]: I1029 14:06:52.867981   23831 cni.go:282] Got netns path /proc/24188/ns/net
10月 29 14:06:52 node2 origin-node[23831]: I1029 14:06:52.868022   23831 cni.go:283] Using netns path default
10月 29 14:06:52 node2 origin-node[23831]: I1029 14:06:52.868030   23831 cni.go:254] About to run with conf.Network.Type=calico
10月 29 14:06:53 node2 origin-node[23831]: 2017-10-29 14:06:52.999 [WARNING][24222] calico.go 54: Configuration option 'hostname' is deprecated, use 'nodename' instead. Workload="default.hello-openshift"
10月 29 14:06:53 node2 origin-node[23831]: 2017-10-29 14:06:52.999 [INFO][24222] calico.go 85: Extracted identifiers Node="node2" Orchestrator="k8s" Workload="default.hello-openshift"
10月 29 14:06:53 node2 origin-node[23831]: 2017-10-29 14:06:52.999 [INFO][24222] calico.go 87: Loaded CNI NetConf NetConfg=utils.NetConf{CNIVersion:"", Name:"calico", Type:"calico", IPAM:struct { Name string; Type string "json:\"type\""; Subnet string "json:\"subnet\""; AssignIpv4 *string "json:\"assign_ipv4\""; AssignIpv6 *string "json:\"assign_ipv6\""; IPv4Pools []string "json:\"ipv4_pools,omitempty\""; IPv6Pools []string "json:\"ipv6_pools,omitempty\"" }{Name:"", Type:"calico-ipam", Subnet:"", AssignIpv4:(*string)(nil), AssignIpv6:(*string)(nil), IPv4Pools:[]string(nil), IPv6Pools:[]string(nil)}, MTU:0, Hostname:"node2", Nodename:"", DatastoreType:"", EtcdAuthority:"", EtcdEndpoints:"https://master:2379", LogLevel:"debug", Policy:utils.Policy{PolicyType:"k8s", K8sAPIRoot:"", K8sAuthToken:"", K8sClientCertificate:"", K8sClientKey:"", K8sCertificateAuthority:""}, Kubernetes:utils.Kubernetes{K8sAPIRoot:"", Kubeconfig:"/etc/origin/node/system:node:node2.kubeconfig", NodeName:""}, Args:utils.Args{Mesos:utils.Mesos{NetworkInfo:utils.NetworkInfo{Name:"", Labels:struct { Labels []struct { Key string "json:\"key\""; Value string "json:\"value\"" } "json:\"labels,omitempty\"" }{Labels:[]struct { Key string "json:\"key\""; Value string "json:\"value\"" }(nil)}}}}, EtcdScheme:"", EtcdKeyFile:"/etc/origin/calico/calico.etcd-client.key", EtcdCertFile:"/etc/origin/calico/calico.etcd-client.crt", EtcdCaCertFile:"/etc/origin/calico/calico.etcd-ca.crt"} Workload="default.hello-openshift"
10月 29 14:06:53 node2 origin-node[23831]: 2017-10-29 14:06:53.000 [INFO][24222] utils.go 250: Configured environment: [LANG=en_US.UTF-8 PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin NOTIFY_SOCKET=/run/systemd/notify GOTRACEBACK=crash OPTIONS=--loglevel=4 CONFIG_FILE=/etc/origin/node/node-config.yaml IMAGE_VERSION=v3.6.0 CNI_COMMAND=ADD CNI_CONTAINERID=19bb4492d286727521e2d5335fdc2721919f9edf855b4047c3da6e4c05b36b75 CNI_NETNS=/proc/24188/ns/net CNI_ARGS=IgnoreUnknown=1;IgnoreUnknown=1;K8S_POD_NAMESPACE=default;K8S_POD_NAME=hello-openshift;K8S_POD_INFRA_CONTAINER_ID=19bb4492d286727521e2d5335fdc2721919f9edf855b4047c3da6e4c05b36b75 CNI_IFNAME=eth0 CNI_PATH=/opt/cni/bin:/opt/calico/bin ETCD_ENDPOINTS=https://master:2379 ETCD_KEY_FILE=/etc/origin/calico/calico.etcd-client.key ETCD_CERT_FILE=/etc/origin/calico/calico.etcd-client.crt ETCD_CA_CERT_FILE=/etc/origin/calico/calico.etcd-ca.crt KUBECONFIG=/etc/origin/node/system:node:node2.kubeconfig]
10月 29 14:06:53 node2 origin-node[23831]: 2017-10-29 14:06:53.000 [INFO][24222] client.go 202: Loading config from environment
10月 29 14:06:53 node2 origin-node[23831]: 2017-10-29 14:06:53.000 [DEBUG][24222] client.go 31: Using datastore type 'etcdv2'
10月 29 14:06:53 node2 origin-node[23831]: 2017-10-29 14:06:53.000661 I | warning: ignoring ServerName for user-provided CA for backwards compatibility is deprecated
10月 29 14:06:53 node2 origin-node[23831]: 2017-10-29 14:06:53.000 [DEBUG][24222] validator.go 162: Validate name: node2
10月 29 14:06:53 node2 origin-node[23831]: 2017-10-29 14:06:53.000 [DEBUG][24222] validator.go 168: Validate namespacedname: default.hello-openshift
10月 29 14:06:53 node2 origin-node[23831]: 2017-10-29 14:06:53.000 [DEBUG][24222] validator.go 168: Validate namespacedname: k8s
10月 29 14:06:53 node2 origin-node[23831]: 2017-10-29 14:06:53.000 [DEBUG][24222] etcd.go 261: List Key: /calico/v1/host/node2/workload/k8s/default.hello-openshift/endpoint
10月 29 14:06:53 node2 origin-node[23831]: 2017-10-29 14:06:53.013 [DEBUG][24222] etcd.go 363: Key not found error
10月 29 14:06:53 node2 origin-node[23831]: 2017-10-29 14:06:53.013 [DEBUG][24222] calico.go 102: Retrieved endpoints: &{{workloadEndpointList v1} {} []} Workload="default.hello-openshift"
10月 29 14:06:53 node2 origin-node[23831]: Calico CNI checking for existing endpoint: <nil>
10月 29 14:06:53 node2 origin-node[23831]: 2017-10-29 14:06:53.013 [INFO][24222] k8s.go 67: Extracted identifiers for CmdAddK8s Node="node2" Orchestrator="k8s" Workload="default.hello-openshift"
10月 29 14:06:53 node2 origin-node[23831]: 2017-10-29 14:06:53.047 [DEBUG][24222] k8s.go 124: Fetched K8s labels Workload="default.hello-openshift" labels=map[string]string{"name":"hello-openshift", "calico/k8s_ns":"default"}
10月 29 14:06:53 node2 origin-node[23831]: 2017-10-29 14:06:53.047 [DEBUG][24222] k8s.go 125: Fetched K8s annotations Workload="default.hello-openshift" annotations=map[string]string{"openshift.io/scc":"anyuid"}
10月 29 14:06:53 node2 origin-node[23831]: 2017-10-29 14:06:53.047 [DEBUG][24222] k8s.go 185: Calling IPAM plugin calico-ipam Workload="default.hello-openshift"
10月 29 14:06:53 node2 origin-node[23831]: E1029 14:06:53.050233   23831 cni.go:257] Error adding network: netplugin failed but error parsing its diagnostic message "": unexpected end of JSON input
10月 29 14:06:53 node2 origin-node[23831]: E1029 14:06:53.050272   23831 cni.go:211] Error while adding to cni network: netplugin failed but error parsing its diagnostic message "": unexpected end of JSON input
10月 29 14:06:53 node2 origin-node[23831]: E1029 14:06:53.137457   23831 remote_runtime.go:86] RunPodSandbox from runtime service failed: rpc error: code = 2 desc = NetworkPlugin cni failed to set up pod "hello-openshift_default" network: netplugin failed but error parsing its diagnostic message "": unexpected end of JSON input
10月 29 14:06:53 node2 origin-node[23831]: E1029 14:06:53.137546   23831 kuberuntime_sandbox.go:54] CreatePodSandbox for pod "hello-openshift_default(d5eaa63c-bc70-11e7-8966-001c42066040)" failed: rpc error: code = 2 desc = NetworkPlugin cni failed to set up pod "hello-openshift_default" network: netplugin failed but error parsing its diagnostic message "": unexpected end of JSON input
Expected Result

Pod creation succeed.

Additional Information

[try to run $ oc adm diagnostics (or oadm diagnostics) command if possible] [if you are reporting issue related to builds, provide build logs with BUILD_LOGLEVEL=5] [consider attaching output of the $ oc get all -o json -n <namespace> command to the issue] [visit https://docs.openshift.org/latest/welcome/index.html]

I noticed that version 1.10.0 for calico and calico-ipam are used in openshift-ansible project. I think it's a BUG for calico cni plugin. Update cni to 0.6.0 and calico cni plugin to 2.0.0, error again. At last I changed the calico-ipam version from 1.10.0 to 1.9.1. Problem solved.

fengbeihong avatar Nov 01 '17 01:11 fengbeihong

FWIW, I'm running calico-ipam v1.10.0 and am not seeing this issue.

What OS is this deployed on?

What is the output of 'calicoctl get ippool -o yaml'

(cc: @ozdanborne)

kprabhak avatar Nov 12 '17 20:11 kprabhak

Issues go stale after 90d of inactivity.

Mark the issue as fresh by commenting /remove-lifecycle stale. Stale issues rot after an additional 30d of inactivity and eventually close. Exclude this issue from closing by commenting /lifecycle frozen.

If this issue is safe to close now please do so with /close.

/lifecycle stale

openshift-bot avatar Feb 25 '18 05:02 openshift-bot

Stale issues rot after 30d of inactivity.

Mark the issue as fresh by commenting /remove-lifecycle rotten. Rotten issues close after an additional 30d of inactivity. Exclude this issue from closing by commenting /lifecycle frozen.

If this issue is safe to close now please do so with /close.

/lifecycle rotten /remove-lifecycle stale

openshift-bot avatar Mar 27 '18 05:03 openshift-bot

Rotten issues close after 30d of inactivity.

Reopen the issue by commenting /reopen. Mark the issue as fresh by commenting /remove-lifecycle rotten. Exclude this issue from closing again by commenting /lifecycle frozen.

/close

openshift-bot avatar Apr 26 '18 05:04 openshift-bot