How can I remove a deprecated version of a specific API resource from a Kubernetes cluster?

7/27/2018

When the storage version of a Kubernetes API resource changes, is it still necessary to manually read and write back resources as describe here or does the apiserver now deal with this automatically?

For example, if I wanted to remove the deprecated extensions/v1beta1 version of deployments from my cluster and migrate to apps/v1 would it be enough to specify --storage-versions=extensions=apps/v1 on the apiserver and then ‘wait for a bit’ before setting something like ---runtime-config=api/all=true,extensions/v1beta1/deployments=false? Or would I have to use the update-storage-objects.sh script after setting --storage-versions=extensions=apps/v1?

Additionally, would specifying --storage-versions=extensions=apps/v1 cause any issues for ingress resources that still use API version extensions/v1beta1 but have no conversion to apps/v1?

-- dippynark
kubernetes

3 Answers

8/3/2018

does the apiserver now deal with this automatically?

No, the api-server does not do it automatically, you need to do it manually.

Regarding the upgrade between API versions, all necessary steps are described in the official documentation:

This is an infrequent event, but it requires careful management. There

is a sequence of steps to upgrade to a new API version.

  1. Turn on the new API version.

  2. Upgrade the cluster’s storage to use the new version.

  3. Upgrade all config files. Identify users of the old API version endpoints.

  4. Update existing objects in the storage to new version by running cluster/update-storage-objects.sh.

  5. Turn off the old API version.

Step 4 is not only about storage but also about all resources related to the old version which you have in the cluster.

Additionally, would specifying --storage-versions=extensions=apps/v1 cause any issues for ingress resources that still use API version extensions/v1beta1 but have no conversion to apps/v1?

Versioning of each type of resource is independent. Storage and Ingress are different resources so there are no relations between their versions and different versions should not affect them in any way.

-- aurelius
Source: StackOverflow

8/4/2018

The recommended method for doing this is still in flux. Removing API versions is currently prohibited: https://github.com/kubernetes/kubernetes/issues/52185

-- dippynark
Source: StackOverflow

7/27/2018

Im usually upgrading the cluster with a new API version then upgrade the config files but not removing the old API. Only once I had to remove a old API version due to a bug. You can do this by running kubectl get apiservice to list all available versions then kubectl delete apiservice some_api and you don't have to set any other flag.

-- Camil
Source: StackOverflow