[Solved] pod CIDR not assigned

Table of contents

No heading

No headings in the article.

In some cases while adding worker node in existing cluster you may get following error -

Error registering network: failed to acquire lease: node "worker-no-xx" pod cidr not assigned

How to identify the error -

Canal pod will restart again and again, check the log of that pod and you will get the above mentioned error in the log window.

How to fix -

First identify the podcidr of your existing nodes in your cluster using following command-

kubectl get no -o yaml | grep -i podcidr

You will get podcidrs of all the existing nodes -

Output -

    podCIDR: 10.244.2.0/24
    podCIDRs:
    podCIDR: 10.244.1.0/24
    podCIDRs:
    podCIDR: 10.244.3.0/24
    podCIDRs:
    podCIDR: 10.244.0.0/24
    podCIDRs:

Now patch you new node with podcidr by running following command -

kubectl patch node 123-98-15.hostname.net -p '{"spec":{"podCIDR":"10.244.4.0/24"}}'

Please avoid any type of conflict while patching the node.

Thanks

Follow me on twitter @thesniperxjohn