Sub topic 9
Checking CNI, CSI, ingress controllers, CRDs, and webhooks
This chapter assumes you know the version skew rules and have a list of deprecated APIs from earlier chapters. It also assumes you can read kubectl output and know what a DaemonSet and a CustomResourceDefinition (CRD) are.
Why add-ons need their own check
Kubernetes itself can be upgraded correctly while the software around it breaks. Add-ons are built against specific Kubernetes versions. They call the API server, and some of the APIs they call may be removed in your target release. Check each add-on's compatibility matrix against the target version before you start.
| Add-on | What it does | Typical upgrade risk |
|---|---|---|
| CNI plugin | Pod networking and NetworkPolicy | A version too old for the new kubelet or kernel features breaks Pod networking |
| CSI driver | Volume provisioning and attach | Old sidecars may use removed APIs, so volumes fail to attach |
| Ingress controller | Routes external traffic | May only watch `Ingress` in a removed API version |
| CRDs and operators | Custom resource types | Operators may need a newer release |
| Admission webhooks | Validate or change requests | An unreachable webhook can block API requests |
Take an inventory
Start by listing what runs in the cluster and which versions it uses.
# Networking and storage components usually run in kube-system
kubectl get daemonset,deployment -n kube-system -o wide
# Installed CSI drivers and ingress classes
kubectl get csidrivers
kubectl get ingressclass
# CRDs, the versions they serve, and the versions stored in etcd
kubectl get crd -o custom-columns=NAME:.metadata.name,SERVED:.spec.versions[*].name,STORED:.status.storedVersions
# Webhooks and what happens when they fail
kubectl get validatingwebhookconfigurations,mutatingwebhookconfigurations
kubectl get validatingwebhookconfiguration -o custom-columns=NAME:.metadata.name,FAILURE_POLICY:.webhooks[*].failurePolicyRecord the image tag of each component. Then read each project's release notes for the target Kubernetes version. If a component does not support it, upgrade that component first, provided the current Kubernetes version still supports the newer release.
Webhooks deserve extra care
A webhook with failurePolicy: Fail rejects every matching request when its backing Pods are unavailable. During a node drain, the webhook's own Pods can be evicted. If they match the webhook's rules, you can deadlock your own upgrade. Reduce this risk in three ways:
- Run at least two webhook replicas on different nodes.
- Protect them with a PodDisruptionBudget (covered in a later chapter).
- Exclude system namespaces, such as
kube-system, with anamespaceSelector.
Also check that each webhook configuration uses admissionregistration.k8s.io/v1 and that admissionReviewVersions includes v1. The v1beta1 versions were removed in Kubernetes 1.22.
CRDs and operators
A CRD defines an API that an operator or controller uses. Look at two things:
- The CRD's own
apiextensions.k8s.ioversion.v1beta1was removed in 1.22, so old operator releases that install it will fail. - The
storedVersionslist from the command above. If it contains a version you plan to stop serving, migrate those objects first.
Exercise
A cluster has a validating webhook with failurePolicy: Fail, running as a single Pod in a namespace that the webhook itself matches. Why is this risky during a node drain, and what two changes reduce the risk?
Show answer
Draining the node evicts the only webhook Pod. Its replacement cannot be created, because that request matches the webhook, and the webhook is down, so the API server rejects it. Run at least two replicas on different nodes with a PodDisruptionBudget, and exclude the webhook's own namespace with a namespaceSelector.