Get the App
SLTechnology News&Howtos  ›  Servers  › 

How to upgrade Kubernetes 1.16.0 quickly

Shulou Source: shulou.com Published: 2022-05-31 17:23:45 11月12日 Update

Editor to share with you how to quickly upgrade Kubernetes 1.16.0, I believe most people do not know much about it, so share this article for your reference, I hope you can learn a lot after reading this article, let's go to know it!

1. Upgrade kubeadm/kubectl/kubelet version sudo apt install kubeadm=1.16.0-00 kubectl=1.16.0-00 kubelet=1.16.0-00

Kubernetes for china

View the container image version of this version:

Kubeadm config images list

The output is as follows:

~ # kubeadm config images listk8s.gcr.io/kube-apiserver:v1.16.0k8s.gcr.io/kube-controller-manager:v1.16.0k8s.gcr.io/kube-scheduler:v1.16.0k8s.gcr.io/kube-proxy:v1.16.0k8s.gcr.io/pause:3.1k8s.gcr.io/etcd:3.3.15-0k8s.gcr.io/coredns:1.6.22, pull container image

The original kubernetes image file is on gcr and cannot be downloaded directly. I mirrored it to the container warehouse in Ariyun's Hangzhou computer room, and it was relatively fast to pull it.

Echo "" echo "=" echo "Pull Kubernetes v1.16.0 Images from aliyuncs.com." echo "= =" echo "" MY_REGISTRY=registry.cn-hangzhou.aliyuncs.com/openthings## pull image docker pull ${MY_REGISTRY} / k8s-gcr-io-kube-apiserver:v1.16.0docker pull ${MY_REGISTRY} / k8s-gcr-io-kube-controller-manager:v1.16.0docker pull ${MY_REGISTRY} / k8sMugcrashi Scheduler:v1.16.0docker pull ${MY_REGISTRY} / k8s-gcr-io-kube-proxy:v1.16.0docker pull ${MY_REGISTRY} / k8s-gcr-io-etcd:3.3.15-0docker pull ${MY_REGISTRY} / k8s-gcr-io-pause:3.1docker pull ${MY_REGISTRY} / k8s-gcr-io-coredns:1.6.2## add Tagdocker tag ${MY_REGISTRY} / k8s-gcr-io-kube-apiserver:v1.16 .0 k8s.gcr.io/kube-apiserver:v1.16.0docker tag ${MY_REGISTRY} / k8s-gcr-io-kube-scheduler:v1.16.0 k8s.gcr.io/kube-scheduler:v1.16.0docker tag ${MY_REGISTRY} / k8s-gcr-io-kube-controller-manager:v1.16.0 k8s.gcr.io/kube-controller-manager:v1.16.0docker tag ${MY_REGISTRY} / k8s-gcr-io-kube-proxy:v1.16.0 K8s.gcr.io/kube-proxy:v1.16.0docker tag ${MY_REGISTRY} / k8s-gcr-io-etcd:3.3.15-0 k8s.gcr.io/etcd:3.3.15-0docker tag ${MY_REGISTRY} / k8s-gcr-io-pause:3.1 k8s.gcr.io/pause:3.1docker tag ${MY_REGISTRY} / k8s-gcr-io-coredns:1.6.2 k8s.gcr.io/coredns:1.6.2echo "" echo "echo" Pull Kubernetes v1.16.0 Images FINISHED. "echo" into registry.cn-hangzhou.aliyuncs.com/openthings "echo" by openthings@ https://my.oschina.net/u/2306127."echo "=" echo ""

Save as a shell script and execute it.

Or, download the script: https://github.com/openthings/kubernetes-tools/blob/master/kubeadm/2-images/

3. Upgrade Kubernetes cluster

New installation:

# specify IP address, version 1.16.0: sudo kubeadm init-- kubernetes-version=v1.16.0-- apiserver-advertise-address=10.1.1.199-- pod-network-cidr=10.244.0.0/16# Note: CoreDNS is built-in, and the parameter-- feature-gates CoreDNS=true is no longer required

First take a look at the versions of the components that need to be upgraded.

Using kubeadm upgrade plan, the version upgrade information is output as follows:

COMPONENT CURRENT AVAILABLEAPI Server v1.15.2 v1.16.0Controller Manager v1.15.2 v1.16.0Scheduler v1.15.2 v1.16.0Kube Proxy v1.15.2 v1.16.0CoreDNS 1.3.1 1.6.2Etcd 3.3.10 3.3.15-0

Make sure that the above container image has been downloaded (if it is not downloaded in advance, it may be suspended by the network), and then perform the upgrade:

Kubeadm upgrade-y apply v1.16.0

If you see the following message, OK it.

[upgrade/successful] SUCCESS! Your cluster was upgraded to "v1.16.0". Enjoy!

Then, configure the current user environment:

Mkdir-p $HOME/.kube sudo cp-I / etc/kubernetes/admin.conf $HOME/.kube/config sudo chown $(id-u): $(id-g) $HOME/.kube/config

You can use kubectl version to view the status and kubectl cluster-info to view the service address.

4. Upgrade of work node

Each worker node needs to pull the image facing the corresponding version and install the corresponding version of kubelet.

Check the version:

~ $kubectl version

View Pod information:

Kubectl get pod-all-namespaces

Done.

The above is all the contents of the article "how to upgrade Kubernetes 1.16.0 quickly". Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!

Tags: Version upgrade image container information article content address script node work output original not so repository brand new parameters most files more Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno MariaDB NVidia Shulou Tech Info Huawei MySQL