I am using apiversion : apps/v1beta2
in most of deployment however Kubernetes cluster version 1.14
it's recommended to use apiversion : apps/v1
. Also v1beta2 will be deprecated from Kubernetes 1.16
.
Is there any better option to reduce manual work and update all deployment which having version apps/v1beta2
to v1
.
Or I can use patch
all deployment.
Before you apply any changes please make sure that they include any necessary changes to suit the 1.16
version.
Some of the changes are:
Deployment in the extensions/v1beta1, apps/v1beta1, and apps/v1beta2 API versions is no longer served
- Migrate to use the apps/v1 API version, available since v1.9. Existing persisted data can be retrieved/updated via the new version.
- Notable changes:
spec.rollbackTo
is removedspec.selector
is now required and immutable after creation; use the existing template labels as the selector for seamless upgradesspec.progressDeadlineSeconds
now defaults to600
seconds (the default inextensions/v1beta1
was no deadline)spec.revisionHistoryLimit
now defaults to10
(the default inapps/v1beta1
was2
, the default inextensions/v1beta1
was to retain all)maxSurge
andmaxUnavailable
now default to25%
(the default inextensions/v1beta1
was1
)
Please refer to above link to check aforementioned necessary changes.
kubectl patch
There is an official documentation about it: Kubernetes.io: update api object kubectl patch
Unfortunately the kubectl patch
did change the YAML
definition from the example but it was unable to change the apiVersion
.
kubectl convert
There is a tool built into kubectl
named kubectl convert
which converts existing YAML
to suit the 1.16
version. Please take in mind that it will be deprecated soon. Take a look at the article about it: Medium.com: Kubectl convert update api versions automatically
You could also write a script with the language of your choosing that will change:
apiVersion: apps/v1beta2
apiVersion: apps/v1beta1
to:
apiVersion: apps/v1
You could also take a look on: Github.com: Kustomize
Please let me know if you have any questions to that.