Upgrading Calico

About upgrading Calico

The upgrade procedure varies according to how you originally installed Calico and your datastore type.

Important: Do not use older versions of calicoctl after the upgrade. This may result in unexpected behavior and data.

Upgrading an installation that uses the Kubernetes API datastore

  1. If your configuration uses RBAC, use the following command to create the roles and role bindings for Calico’s components:

    kubectl apply -f \
    https://docs.projectcalico.org/v3.2/getting-started/kubernetes/installation/hosted/rbac-kdd.yaml
    

    Note: You can also view the manifest in your browser.

  2. Download the v3.2 manifest that corresponds to your original installation method.

    Calico for policy and networking

    curl \
    https://docs.projectcalico.org/v3.2/getting-started/kubernetes/installation/hosted/kubernetes-datastore/calico-networking/1.7/calico.yaml \
    -O
    

    Calico for policy and flannel for networking

    curl \
    https://docs.projectcalico.org/v3.2/getting-started/kubernetes/installation/hosted/canal/canal.yaml \
    -O
    

    Calico for policy (advanced)

    curl \
    https://docs.projectcalico.org/v3.2/getting-started/kubernetes/installation/hosted/kubernetes-datastore/policy-only/1.7/calico.yaml \
    -O
    

    Note: If you manually modified the manifest, you must manually apply the same changes to the downloaded manifest.

  3. Use the following command to initiate a rolling update, after replacing <manifest-file-name> with the file name of your v3.2 manifest.

    kubectl apply -f <manifest-file-name>
    
  4. Watch the status of the upgrade as follows.

    watch kubectl get pods -n kube-system
    

    Verify that the status of all Calico pods indicate Running.

    calico-node-hvvg8     2/2   Running   0    3m
    calico-node-vm8kh     2/2   Running   0    3m
    calico-node-w92wk     2/2   Running   0    3m
    
  5. Remove any existing calicoctl instances, install the new calicoctl and configure it to connect to your datastore.

  6. Use the following command to check the Calico version number.

    calicoctl version
    

    It should return a Cluster Version of v3.2.x.

    Note: If upgrading from Calico 2.6.x and an error occurs during the upgrade, refer to Downgrading Calico.

  7. Congratulations! You have upgraded to Calico v3.2.

Upgrading an installation that uses an etcd datastore

  1. If your configuration uses RBAC, use the following command to create the roles and role bindings for Calico’s components:

    kubectl apply -f \
    https://docs.projectcalico.org/v3.2/getting-started/kubernetes/installation/rbac.yaml
    

    Note: You can also view the manifest in your browser.

  2. Download the v3.2 manifest that corresponds to your original installation method.

    Calico for policy and networking

    curl \
    https://docs.projectcalico.org/v3.2/getting-started/kubernetes/installation/hosted/calico.yaml \
    -O
    

    Calico for policy and flannel for networking

    curl \
    https://docs.projectcalico.org/v3.2/getting-started/kubernetes/installation/hosted/canal/canal-etcd.yaml \
    -O
    

    Note: You must must manually apply the changes you made to the manifest during installation to the downloaded v3.2 manifest. At a minimum, you must set the etcd_endpoints value.

  3. Use the following command to initiate a rolling update, after replacing <manifest-file-name> with the file name of your v3.2 manifest.

    kubectl apply -f <manifest-file-name>
    
  4. Watch the status of the upgrade as follows.

    watch kubectl get pods -n kube-system
    

    Verify that the status of all Calico pods indicate Running.

    calico-kube-controllers-6d4b9d6b5b-wlkfj   1/1       Running   0          3m
    calico-node-hvvg8                          1/2       Running   0          3m
    calico-node-vm8kh                          1/2       Running   0          3m
    calico-node-w92wk                          1/2       Running   0          3m
    

    Tip: The calico-node pods will report 1/2 in the READY column, as shown.

    Note: If upgrading from Calico 2.6.x and an error occurs during the upgrade, refer to an error occurs during the upgrade, refer to Downgrading Calico.

  5. Remove any existing calicoctl instances, install the new calicoctl and configure it to connect to your datastore.

  6. Use the following command to check the Calico version number.

    calicoctl version
    

    It should return a Cluster Version of v3.2.x.

  7. If you are upgrading from Calico 3.x, skip to the next step. Otherwise, for those upgrading from Calico 2.6.x, wait for some time to really ensure that the upgrade succeeded and no problems ensued. Then complete the upgrade by running calico-upgrade complete. After this, you can once again schedule pods and make changes to configuration and policy.

    Important: If you experience errors after running calico-upgrade complete, such as an inability to schedule pods, downgrade Calico as soon as possible.

  8. Congratulations! You have upgraded to Calico v3.2.