Upgrading using the Knative Operator
The Knative Operator supports up to the last three major releases. For example, if the current version of the Operator is 0.23, it bundles and supports the installation of Knative versions 0.20, 0.21, 0.22 and 0.23.
Note
In the following examples, Knative Serving custom resources are installed in the knative-serving
namespace, and Knative Eventing custom resources are installed in the knative-eventing
namespace.
To upgrade, apply the Operator custom resources, adding the spec.version
for the Knative version that you want to upgrade to:
Copy the following YAML into a file:
Apply the YAML file by running the command:
kubectl apply -f <filename>.yaml
Where
<filename>
is the name of the file you created in the previous step.
You can confirm that your Knative components have upgraded successfully, by viewing the status of the pods for the components in the relevant namespace.
Note
Knative Serving
Enter the following command to view information about pods in the knative-serving
namespace:
kubectl get pods --namespace knative-serving
The command returns an output similar to the following:
NAME READY STATUS RESTARTS AGE
activator-6875896748-gdjgs 1/1 Running 0 58s
autoscaler-6bbc885cfd-vkrgg 1/1 Running 0 57s
autoscaler-hpa-5cdd7c6b69-hxzv4 1/1 Running 0 55s
net-istio-webhook-75cc84fbd4-dkcgt 1/1 Running 0 50s
storage-version-migration-serving-serving-0.20.0-82hjt 0/1 Completed 0 50s
webhook-75f5d4845d-zkrdt 1/1 Running 0 56s
Knative Eventing
Enter the following command to view information about pods in the knative-eventing
namespace:
The command returns an output similar to the following:
NAME READY STATUS RESTARTS AGE
eventing-controller-6bc59c9fd7-6svbm 1/1 Running 0 38s
eventing-webhook-85cd479f87-4dwxh 1/1 Running 0 38s
imc-controller-97c4fd87c-t9mnm 1/1 Running 0 33s
imc-dispatcher-c6db95ffd-ln4mc 1/1 Running 0 33s
mt-broker-controller-5f87fbd5d9-m69cd 1/1 Running 0 32s
mt-broker-filter-5b9c64cbd5-d27p4 1/1 Running 0 32s
mt-broker-ingress-55c66fdfdf-gn56g 1/1 Running 0 32s
storage-version-migration-eventing-0.20.0-fvgqf 0/1 Completed 0 31s
sugar-controller-684d5cfdbb-67vsv 1/1 Running 0 31s
You can verify the status of a Knative component by checking that the custom resource READY
status is .
Knative Serving
kubectl get KnativeServing knative-serving --namespace knative-serving
This command returns an output similar to the following:
NAME VERSION READY REASON
This command returns an output similar to the following:
NAME VERSION READY REASON
knative-eventing 0.20.0 True
If the upgrade fails, you can rollback to restore your Knative to the previous version. For example, if something goes wrong with an upgrade to 0.23, and your previous version is 0.22, you can apply the following custom resources to restore Knative Serving and Knative Eventing to version 0.22.
Knative Serving
Copy the following YAML into a file:
apiVersion: operator.knative.dev/v1alpha1
kind: KnativeServing
metadata:
name: knative-serving
namespace: knative-serving
spec:
version: "0.22"
Apply the YAML file by running the command:
kubectl apply -f <filename>.yaml
Where
<filename>
is the name of the file you created in the previous step.
Knative Eventing
Copy the following YAML into a file:
1. Apply the YAML file by running the command:
kubectl apply -f <filename>.yaml