I need to upgrade kubernetes from 1.18.4 -> 1.21.10 and retain the use of docker as my cri. Normally conatinrd will auto install with kubernetes greater than 1.21 .
It is recomended that a cluster be upgraded 1 version at a time so we will follow:
1.18.4 -> 1.19.16 -> 1.20.15 -> 1.21.12
https://kops.sigs.k8s.io/operations/updates_and_upgrades/
https://kubernetes.io/releases/patch-releases/#support-period
apiVersion: kops.k8s.io/v1alpha2
kind: Cluster
metadata:
creationTimestamp: "2022-05-29T20:26:05Z"
name: k8s.myezbrew.com
spec:
api:
dns: {}
authorization:
rbac: {}
channel: stable
cloudProvider: aws
configBase: s3://kops-myezbrew/k8s.myezbrew.com
etcdClusters:
- cpuRequest: 200m
etcdMembers:
- encryptedVolume: true
instanceGroup: master-us-east-1c
name: c
memoryRequest: 100Mi
name: main
- cpuRequest: 100m
etcdMembers:
- encryptedVolume: true
instanceGroup: master-us-east-1c
name: c
memoryRequest: 100Mi
name: events
iam:
allowContainerRegistry: true
legacy: false
kubelet:
anonymousAuth: false
kubernetesApiAccess:
- 65.130.186.142/32
# - ::/0
masterPublicName: api.k8s.myezbrew.com
networkCIDR: 172.20.0.0/16
networking:
kubenet: {}
nonMasqueradeCIDR: 100.64.0.0/10
kubernetesVersion: 1.18.14
containerRuntime: docker
sshAccess:
- 65.130.186.142/32
# - ::/0
subnets:
- cidr: 172.20.32.0/19
name: us-east-1c
type: Public
zone: us-east-1c
topology:
dns:
type: Public
masters: public
nodes: public
---
apiVersion: kops.k8s.io/v1alpha2
kind: InstanceGroup
metadata:
creationTimestamp: "2022-05-30T00:49:36Z"
labels:
kops.k8s.io/cluster: k8s.myezbrew.com
name: master-us-east-1c
spec:
image: 099720109477/ubuntu/images/hvm-ssd/ubuntu-focal-20.04-amd64-server-20220509
instanceMetadata:
httpPutResponseHopLimit: 3
httpTokens: required
machineType: t2.small
maxSize: 1
minSize: 1
nodeLabels:
kops.k8s.io/instancegroup: master-us-east-1c
role: Master
subnets:
- us-east-1c
---
apiVersion: kops.k8s.io/v1alpha2
kind: InstanceGroup
metadata:
creationTimestamp: "2022-05-30T00:49:36Z"
labels:
kops.k8s.io/cluster: k8s.myezbrew.com
name: nodes
spec:
image: 099720109477/ubuntu/images/hvm-ssd/ubuntu-focal-20.04-amd64-server-20220509
instanceMetadata:
httpPutResponseHopLimit: 1
httpTokens: required
machineType: t2.micro
maxSize: 1
minSize: 1
nodeLabels:
kops.k8s.io/instancegroup: nodes-us-east-1c
role: Node
subnets:
- us-east-1c
---
~/220529_kops on ☁️ (us-west-2)
✦ ❯ kops replace -f cluster.yaml --state s3://kops-myezbrew --force
I0531 07:42:07.265701 55992 replace.go:179] instanceGroup: master-us-east-1c was not found, creating resource now
I0531 07:42:07.795480 55992 replace.go:179] instanceGroup: nodes was not found, creating resource now
~/220529_kops on ☁️ (us-west-2) took 3s
✦ ❯ kops update cluster --name k8s.myezbrew.com --yes --admin
*********************************************************************************
Kops support for this Kubernetes version is deprecated and will be removed in a future release.
Upgrading Kubernetes is recommended
More information: https://github.com/kubernetes/kops/blob/master/permalinks/upgrade_k8s.md#1.20.0
*********************************************************************************
*********************************************************************************
A new kubernetes version is available: 1.18.20
Upgrading is recommended (try kops upgrade cluster)
More information: https://github.com/kubernetes/kops/blob/master/permalinks/upgrade_k8s.md#1.18.20
*********************************************************************************
I0531 07:42:41.435125 55998 executor.go:111] Tasks: 0 done / 88 total; 44 can run
W0531 07:42:41.675573 55998 vfs_castore.go:379] CA private key was not found
I0531 07:42:41.935056 55998 keypair.go:225] Issuing new certificate: "etcd-clients-ca"
I0531 07:42:41.935062 55998 keypair.go:225] Issuing new certificate: "apiserver-aggregator-ca"
I0531 07:42:41.935067 55998 keypair.go:225] Issuing new certificate: "etcd-peers-ca-main"
I0531 07:42:41.935070 55998 keypair.go:225] Issuing new certificate: "etcd-peers-ca-events"
I0531 07:42:41.941815 55998 keypair.go:225] Issuing new certificate: "etcd-manager-ca-events"
I0531 07:42:41.958036 55998 keypair.go:225] Issuing new certificate: "etcd-manager-ca-main"
W0531 07:42:42.210590 55998 vfs_castore.go:379] CA private key was not found
I0531 07:42:42.306906 55998 keypair.go:225] Issuing new certificate: "kubernetes-ca"
I0531 07:42:42.386829 55998 keypair.go:225] Issuing new certificate: "service-account"
I0531 07:42:44.123095 55998 executor.go:111] Tasks: 44 done / 88 total; 20 can run
I0531 07:42:44.389328 55998 keypair.go:225] Issuing new certificate: "kubelet"
I0531 07:42:44.391360 55998 keypair.go:225] Issuing new certificate: "kube-proxy"
I0531 07:42:45.482160 55998 executor.go:111] Tasks: 64 done / 88 total; 20 can run
I0531 07:42:46.831480 55998 executor.go:111] Tasks: 84 done / 88 total; 3 can run
I0531 07:42:48.499430 55998 executor.go:111] Tasks: 86 done / 88 total; 2 can run
I0531 07:42:50.838477 55998 executor.go:111] Tasks: 88 done / 88 total; 0 can run
I0531 07:42:51.674443 55998 dns.go:238] Pre-creating DNS records
I0531 07:42:52.695063 55998 update_cluster.go:326] Exporting kubeconfig for cluster
kOps has set your kubectl context to k8s.myezbrew.com
Cluster is starting. It should be ready in a few minutes.
Suggestions:
* validate cluster: kops validate cluster --wait 10m
* list nodes: kubectl get nodes --show-labels
* ssh to the master: ssh -i ~/.ssh/id_rsa ubuntu@api.k8s.myezbrew.com
* the ubuntu user is specific to Ubuntu. If not using Ubuntu please use the appropriate user based on your OS.
* read about installing addons at: https://kops.sigs.k8s.io/addons.
~/220529_kops on ☁️ (us-west-2) took 19s
✦ ❯
~/220529_kops on ☁️ (us-west-2)
✦ ❯ kgp -A -o wide
NAMESPACE NAME READY STATUS RESTARTS AGE IP NODE NOMINATED NODE READINESS GATES
kube-system dns-controller-5565878bf4-xdb6s 1/1 Running 0 3m30s 172.20.59.44 ip-172-20-59-44.ec2.internal
kube-system etcd-manager-events-ip-172-20-59-44.ec2.internal 1/1 Running 0 3m11s 172.20.59.44 ip-172-20-59-44.ec2.internal
kube-system etcd-manager-main-ip-172-20-59-44.ec2.internal 1/1 Running 0 3m5s 172.20.59.44 ip-172-20-59-44.ec2.internal
kube-system kops-controller-4pmpd 1/1 Running 0 2m42s 172.20.59.44 ip-172-20-59-44.ec2.internal
kube-system kube-apiserver-ip-172-20-59-44.ec2.internal 2/2 Running 1 2m48s 172.20.59.44 ip-172-20-59-44.ec2.internal
kube-system kube-controller-manager-ip-172-20-59-44.ec2.internal 1/1 Running 2 2m34s 172.20.59.44 ip-172-20-59-44.ec2.internal
kube-system kube-dns-85dfb86644-sxtwm 3/3 Running 0 3m30s 100.96.1.2 ip-172-20-48-202.ec2.internal
kube-system kube-dns-85dfb86644-xc82s 3/3 Running 0 93s 100.96.1.4 ip-172-20-48-202.ec2.internal
kube-system kube-dns-autoscaler-75f45987d-pfq7t 1/1 Running 0 3m30s 100.96.1.3 ip-172-20-48-202.ec2.internal
kube-system kube-proxy-ip-172-20-48-202.ec2.internal 1/1 Running 0 2m17s 172.20.48.202 ip-172-20-48-202.ec2.internal
kube-system kube-proxy-ip-172-20-59-44.ec2.internal 1/1 Running 0 2m33s 172.20.59.44 ip-172-20-59-44.ec2.internal
kube-system kube-scheduler-ip-172-20-59-44.ec2.internal 1/1 Running 0 2m57s 172.20.59.44 ip-172-20-59-44.ec2.internal
~/220529_kops on ☁️ (us-west-2) took 3s
✦ ❯
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Ut elit tellus, luctus nec ullamcorper mattis, pulvinar dapibus leo.
kops edit cluster –name k8s.myezbrew.com
~/220529_kops on ☁️ (us-west-2) took 11s
✦ ❯ kops rolling-update cluster --yes --cloudonly
Error: error reading cluster configuration: Cluster.kops.k8s.io "myezbrew.k8s.local" not found
~/220529_kops on ☁️ (us-west-2)
✦ ❯ kops rolling-update cluster --name k8s.myezbrew.com --yes --cloudonly
NAME STATUS NEEDUPDATE READY MIN TARGET MAX
master-us-east-1c NeedsUpdate 1 0 1 1 1
nodes NeedsUpdate 1 0 1 1 1
W0531 07:58:49.374976 56225 instancegroups.go:465] Not validating cluster as cloudonly flag is set.
W0531 07:58:49.375578 56225 instancegroups.go:395] Not draining cluster nodes as 'cloudonly' flag is set.
I0531 07:58:49.375602 56225 instancegroups.go:590] Stopping instance "i-00728a5a934c380ac", in group "master-us-east-1c.masters.k8s.myezbrew.com" (this may take a while).
I0531 07:58:49.616189 56225 instancegroups.go:434] waiting for 15s after terminating instance
W0531 07:59:04.617031 56225 instancegroups.go:465] Not validating cluster as cloudonly flag is set.
W0531 07:59:04.617105 56225 instancegroups.go:465] Not validating cluster as cloudonly flag is set.
W0531 07:59:04.618707 56225 instancegroups.go:395] Not draining cluster nodes as 'cloudonly' flag is set.
I0531 07:59:04.618739 56225 instancegroups.go:590] Stopping instance "i-0a52c5666b5313cea", in group "nodes.k8s.myezbrew.com" (this may take a while).
I0531 07:59:04.962557 56225 instancegroups.go:434] waiting for 15s after terminating instance
W0531 07:59:19.963381 56225 instancegroups.go:465] Not validating cluster as cloudonly flag is set.
I0531 07:59:19.964354 56225 rollingupdate.go:210] Rolling update completed for cluster "k8s.myezbrew.com"!
~/220529_kops on ☁️ (us-west-2) took 33s
✦ ❯ kubectl version
Client Version: version.Info{Major:"1", Minor:"20", GitVersion:"v1.20.15", GitCommit:"8f1e5bf0b9729a899b8df86249b56e2c74aebc55", GitTreeState:"clean", BuildDate:"2022-01-19T17:27:39Z", GoVersion:"go1.15.15", Compiler:"gc", Platform:"darwin/amd64"}
Server Version: version.Info{Major:"1", Minor:"19", GitVersion:"v1.19.16", GitCommit:"e37e4ab4cc8dcda84f1344dda47a97bb1927d074", GitTreeState:"clean", BuildDate:"2021-10-27T16:20:18Z", GoVersion:"go1.15.15", Compiler:"gc", Platform:"linux/amd64"}
~/220529_kops on ☁️ (us-west-2)
✦ ❯
✦ ❯ kgp -A -o wide
NAMESPACE NAME READY STATUS RESTARTS AGE IP NODE NOMINATED NODE READINESS GATES
kube-system dns-controller-5565878bf4-cmsxh 1/1 Running 0 15m 172.20.37.235 ip-172-20-37-235.ec2.internal
kube-system etcd-manager-events-ip-172-20-37-235.ec2.internal 1/1 Running 0 17m 172.20.37.235 ip-172-20-37-235.ec2.internal
kube-system etcd-manager-main-ip-172-20-37-235.ec2.internal 1/1 Running 0 17m 172.20.37.235 ip-172-20-37-235.ec2.internal
kube-system kops-controller-nmd5h 1/1 Running 0 17m 172.20.37.235 ip-172-20-37-235.ec2.internal
kube-system kube-apiserver-ip-172-20-37-235.ec2.internal 2/2 Running 0 17m 172.20.37.235 ip-172-20-37-235.ec2.internal
kube-system kube-controller-manager-ip-172-20-37-235.ec2.internal 1/1 Running 3 18m 172.20.37.235 ip-172-20-37-235.ec2.internal
kube-system kube-dns-85dfb86644-4ghdq 3/3 Running 0 15m 100.96.3.2 ip-172-20-47-117.ec2.internal
kube-system kube-dns-85dfb86644-7w6zv 3/3 Running 0 15m 100.96.3.3 ip-172-20-47-117.ec2.internal
kube-system kube-dns-autoscaler-75f45987d-h4cwl 1/1 Running 0 15m 100.96.3.4 ip-172-20-47-117.ec2.internal
kube-system kube-proxy-ip-172-20-37-235.ec2.internal 1/1 Running 0 17m 172.20.37.235 ip-172-20-37-235.ec2.internal
kube-system kube-proxy-ip-172-20-47-117.ec2.internal 1/1 Running 0 15m 172.20.47.117 ip-172-20-47-117.ec2.internal
kube-system kube-scheduler-ip-172-20-37-235.ec2.internal 1/1 Running 0 17m 172.20.37.235 ip-172-20-37-235.ec2.internal
kops edit cluster –name k8s.myezbrew.com
console.log( 'Code is Poetry' );