The easiest way to run cluster/update-storage-objects.sh
.
cluster/update-storage-objects.sh
is the script file to update existing objects in the storage (etcd) to new version.
Steps to use that script to upgrade the cluster to a new version: https://kubernetes.io/docs/tasks/administer-cluster/cluster-management/#upgrading-to-a-different-api-version
update-storage-objects is a container image which contains patched cluster/update-storage-objects.sh
and kubectl
command.
Note that the below patches have been applied to the cluster/update-storage-objects.sh
in the container image. Please see the details before using.
patches/59403.patch
: Removeendpoints
resource from list of resources to be updated. (kubernetes/kubernetes#59403)patches/60970.patch
: Usekput
command for updating existing objects instead ofkubectl replace
command. (kubernetes/kubernetes#60970)kput
command just updates existing objects. Even if thekubectl.kubernetes.io/last-applied-configuration
annotation existed,kput
command keeps it as it is.
patches/add-skip-error-option.patch
: Add a option to skip errors in case of failing get or replace objects. This feature is available when setSKIP_UPDATE_OBJECT_ERROR
environment variable with any values.patches/add_apps_resources.patch
: Add apps resources(deployments, daemonsets, statefulsets, replicasets) to target resources list for stroage version migration.
You can run this image in your local environment:
docker run -v $HOME/.kube:/.kube -e KUBECONFIG=/.kube/config zlabjp/update-storage-objects:1.6.0
You can also run this image from inside your cluster:
kubectl apply -f https://raw.githubusercontent.com/zlabjp/update-storage-objects/master/deploy/update-storage-objects.yaml
This software is released under the MIT License and includes the work that is distributed in the Apache License 2.0.