Follow the steps below to upgrade Antrea with antrea-operator on Openshift.
Procedure
- Prepare the manifests and image (antrea-operator/antrea/antrea-interworking) with the new version.
- Update the role with the command oc apply -f role.yaml.
- Upgrade antrea-operator by replacing the old image with the new image.
You can either edit operator.yaml or edit the deployment with the command oc -n antrea-operator edit deploy antrea-operator. Make sure that the antrea-operator pod is running.
- (VMware Container Networking with Antrea 1.8.0 or earlier) Upgrade Antrea and antrea-interworking.
- Edit antreainstall CR.
You can either edit operator.antrea.vmware.com_v1_antreainstall_cr.yaml or run the command oc -n antrea-operator edit antreainstall antrea-install. Update antreaImage with the new image.
- (Optional) If antrea-interworking is enabled, update interworkingImage with the new antrea-interworking image.
- Apply the changes.
- Edit antreainstall CR.
- (VMware Container Networking with Antrea 1.9.0 or later) Upgrade Antrea and antrea-interworking.
- Apply the new CRD.
oc apply -f operator.antrea.vmware.com_antreainstalls_crd.yaml customresourcedefinition.apiextensions.k8s.io/antreainstalls.operator.antrea.vmware.com configured
- Edit operator.antrea.vmware.com_v1_antreainstall_cr.yaml and update the following fields:
- antreaAgentImage: <Change this to Image Path>
- antreaControllerImage: <Change this to Image Path>
- Trigger the upgrade.
oc apply -f operator.antrea.vmware.com_antreainstalls_crd.yaml customresourcedefinition.apiextensions.k8s.io/antreainstalls.operator.antrea.vmware.com configured
- Apply the changes.
- Apply the new CRD.
- Check the status.
- Make sure that antrea-controller and antrea-agent are running.
- Check the version of clusteroperator antrea with the command oc get co antrea.
Note:
When upgrading from Antrea 1.8 to Antrea 1.9, you may encounter the following error:CustomResourceDefinition.apiextensions.k8s.io \"clustergroups.crd.antrea.io\" is invalid: [spec.conversion.strategy: Required value, spec.conversion.webhookClientConfig: Forbidden: should not be set when strategy is not set to Webhook]"
To fix the issue, perform the following step and wait for antrea-operator to recover by itself.manager_index="$(kubectl get crd "clustergroups.crd.antrea.io" --show-managed-fields --output json | jq -r '.metadata.managedFields | map(.manager == "antrea-controller") | index(true)')" kubectl patch crd "${crd_name}" --type=json -p="[{\"op\": \"remove\", \"path\": \"/metadata/managedFields/${manager_index}\"}]"