I am using apiversion : apps/v1beta2in 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.rollbackTois removedspec.selectoris now required and immutable after creation; use the existing template labels as the selector for seamless upgradesspec.progressDeadlineSecondsnow defaults to600seconds (the default inextensions/v1beta1was no deadline)spec.revisionHistoryLimitnow defaults to10(the default inapps/v1beta1was2, the default inextensions/v1beta1was to retain all)maxSurgeandmaxUnavailablenow default to25%(the default inextensions/v1beta1was1)
Please refer to above link to check aforementioned necessary changes.
kubectl patchThere 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 convertThere 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/v1beta2apiVersion: apps/v1beta1to:
apiVersion: apps/v1You could also take a look on: Github.com: Kustomize
Please let me know if you have any questions to that.