Migrate DaemonSet from apps/v1beta2
apps/v1beta2 was the last DaemonSet beta, deprecated as soon as apps/v1 arrived in Kubernetes 1.9. 1.16 stopped serving it. In apps/v1 the selector is required and can't be changed after creation, so it must match the pod template labels.
The error
After the upgrade to 1.16,
kubectl apply fails like this:
error: resource mapping not found for name: "<name>" namespace: "<ns>" from "<file>": no matches for kind "DaemonSet" in version "apps/v1beta2"
ensure CRDs are installed first What replaces it
- Replacement
apps/v1- Available since
- 1.9
- Deprecated in
- 1.9
- Removed in
- 1.16
Check a manifest against 1.16, or read the official documentation.
Migration notes
spec.templateGenerationis removedspec.selectoris now required and immutable after creation; use the existing template labels as the selector for seamless upgradesspec.updateStrategy.typenow defaults toRollingUpdate(the default inextensions/v1beta1wasOnDelete)
Before and after
Before:
apiVersion: apps/v1beta2
kind: DaemonSet
metadata:
name: web
spec:
selector:
matchLabels:
app: web
template:
metadata:
labels:
app: web
spec:
containers:
- name: web
image: nginx:1.27 After:
apiVersion: apps/v1
kind: DaemonSet
metadata:
name: web
spec:
selector:
matchLabels:
app: web
template:
metadata:
labels:
app: web
spec:
containers:
- name: web
image: nginx:1.27 Helm upgrade fails after a cluster upgrade
If you installed this with Helm, helm upgrade can fail after the cluster is
upgraded, even if the chart is already fixed. Which error appears depends on your Helm version
and the error text:
Error: UPGRADE FAILED: unable to build kubernetes objects from current release manifest: resource mapping not found for name: "<name>" namespace: "<ns>" from "": no matches for kind "DaemonSet" in version "apps/v1beta2" Error: UPGRADE FAILED: current release manifest contains removed kubernetes api(s) for this kubernetes version and it is therefore unable to build the kubernetes objects for performing the diff. error from kubernetes: unable to recognize "": no matches for kind "DaemonSet" in version "apps/v1beta2" Helm compares your chart with the manifest stored with the release. That stored manifest still has the old API, and the cluster can no longer read it.
To check, get the stored manifest, and paste the output into the checker:
helm get manifest <release> -n <namespace>
To fix the stored record, use the
helm-mapkubeapis plugin, latest tag
v0.6.1. Try --dry-run first. Its README lists support for Helm v3,
so check that it suits your Helm version.
helm plugin install https://github.com/helm/helm-mapkubeapis --version v0.6.1
helm mapkubeapis <release> --namespace <namespace> --dry-run Helm's advice is to move releases to supported APIs before you upgrade the cluster, and not to roll back to a release from before that change.