Error I met
I met error message like Init:ImagePullBackOff
when I tried to create calico pod.
kubectl get pods --all-namespaces
NAMESPACE NAME READY STATUS RESTARTS AGE
kube-system calico-kube-controllers-xxxxxxxxxx-yyyyy 1/1 Running 1 13h
kube-system calico-node-xxxxx 0/1 Init:ImagePullBackOff 0 13h
Why it happened
Yes, it’s because of changed docker hub policy. Recently, I’m in an environment that about 20~30 people use 4 public IP addresses. So, it’s easy to reach docker hub pull rate limit.
kubectl describe pod calico-node-xxxxx -n kube-system
# Failed to pull image "calico/cni:v3.16.4": rpc error: code = Unknown desc = Error response from daemon: toomanyrequests: You have reached your pull rate limit. You may increase the limit by authenticating and upgrading: https://www.docker.com/increase-rate-limit
How to solve
Solve this problem by using quay registry. But, cause this way is not described in Docs, it was little bit hard to find out how to do it.
# install calico
kubectl create -f https://raw.githubusercontent.com/projectcalico/calico/v3.26.1/manifests/tigera-operator.yaml
# To change image registry, get manifest file for custom resources
wget https://raw.githubusercontent.com/projectcalico/calico/v3.26.1/manifests/custom-resources.yaml
# change image registry
CALICO_ALTER_REGISTRY="quay.io/"; sed "0,/spec:/s|spec:|&\n registry: $CALICO_ALTER_REGISTRY|" custom-resources.yaml
# apply manifest file
kubectl apply -f custom-resources.yaml
etc
My colleague advised me to see Docs below,
but It seems like taking some time.