Closed aodj closed 5 years ago
I should elaborate and say that my definition of "calico not working" is that the management-ui
shows all ports open between the three pods (client, frontend and backend).
When I stream the logs from the management-ui
pod, and run it through jq
I can see that the connection state bounces between reachable and unreachable:
$ kubectl logs management-ui-mgfbp --namespace=management-ui --follow=true | grep stdout | awk '{print $6}' | jq -R --stream '. as $line | try fromjson catch $line' | jq -c '.status.targets|sort_by(.url)|reverse'
[{"reachable":false,"url":"http://frontend.stars:80/status"},{"reachable":true,"url":"http://client.client:9000/status"},{"reachable":true,"url":"http://backend.stars:6379/status"}]
[{"reachable":true,"url":"http://frontend.stars:80/status"},{"reachable":true,"url":"http://client.client:9000/status"},{"reachable":false,"url":"http://backend.stars:6379/status"}]
[{"reachable":true,"url":"http://frontend.stars:80/status"},{"reachable":true,"url":"http://client.client:9000/status"},{"reachable":false,"url":"http://backend.stars:6379/status"}]
[{"reachable":true,"url":"http://frontend.stars:80/status"},{"reachable":true,"url":"http://backend.stars:6379/status"}]
[{"reachable":false,"url":"http://frontend.stars:80/status"},{"reachable":true,"url":"http://client.client:9000/status"},{"reachable":true,"url":"http://backend.stars:6379/status"}]
[{"reachable":false,"url":"http://frontend.stars:80/status"},{"reachable":true,"url":"http://client.client:9000/status"},{"reachable":true,"url":"http://backend.stars:6379/status"}]
[{"reachable":true,"url":"http://frontend.stars:80/status"},{"reachable":true,"url":"http://backend.stars:6379/status"}]
[{"reachable":true,"url":"http://frontend.stars:80/status"},{"reachable":true,"url":"http://client.client:9000/status"},{"reachable":false,"url":"http://backend.stars:6379/status"}]
[{"reachable":true,"url":"http://frontend.stars:80/status"},{"reachable":true,"url":"http://backend.stars:6379/status"}]
[{"reachable":true,"url":"http://frontend.stars:80/status"},{"reachable":true,"url":"http://client.client:9000/status"},{"reachable":false,"url":"http://backend.stars:6379/status"}]
[{"reachable":false,"url":"http://frontend.stars:80/status"},{"reachable":true,"url":"http://client.client:9000/status"},{"reachable":true,"url":"http://backend.stars:6379/status"}]
[{"reachable":true,"url":"http://frontend.stars:80/status"},{"reachable":true,"url":"http://client.client:9000/status"},{"reachable":false,"url":"http://backend.stars:6379/status"}]
^C
If you look at the reachable
status of the frontend.stars
pod, you can see it bounces between true
and false
I'm not familiar with what minikube stop / start
will actually do, but I'd check firstly that the policies you configured are still present in etcd and that they haven't been removed somehow.
e.g. calicoctl get networkpolicy --namespace stars
$ kubectl get netpol --all-namespaces
NAMESPACE NAME POD-SELECTOR AGE
client allow-ui <none> 10h
client default-deny <none> 10h
stars allow-ui <none> 10h
stars backend-policy role=backend 10h
stars default-deny <none> 10h
stars frontend-policy role=frontend 10h
$ kubectl exec -ti -n kube-system calicoctl -- /calicoctl get networkpolicy --all-namespaces
NAMESPACE NAME
client knp.default.allow-ui
client knp.default.default-deny
stars knp.default.allow-ui
stars knp.default.backend-policy
stars knp.default.default-deny
stars knp.default.frontend-policy
@aodj are all the Calico pods running successfully? Do you see any errors in the Calico logs?
If there are no errors, could you check the output of iptables save -c
on one of the nodes and include it here?
The other thing to check would be if Calico CNI is still being used after the restart - this sounds a lot like minikube started using something else (e.g., kubenet).
Expected Behavior
Restarting
minikube
shouldn't break CalicoCurrent Behavior
After getting the stars demo working, and stop/starting the
minikube
cluster, Calico starts but doesn't prevent pod to pod communicationPossible Solution
Steps to Reproduce (for bugs)
minikube
cluster like so:management-ui
should show the restricted communications between pods, as the stars demo explainsminikube
:minikube stop
minikube
:minikube start
4a. Note that running the sameminikube start --cpus 4 --memory 4096 --extra-config=kubelet.network-plugin=cni --network-plugin=cni
doesn't make any differencemanagement-ui
again:open http://$(minikube ip):$(kubectl get svc --namespace=management-ui -o json | jq -r .items[0].spec.ports[0].nodePort)
Context
This shouldn't happen, and I can't work out how to even begin debugging Calico properly to provide more information here. If anyone can provide guidelines here that would be great, because I couldn't work out what I should be doing after setting up
calicoctl
(as a k8s pod).Your Environment