Updating masters

Updating masters is the same as updating nodes. Note that masters in the same availability zone are in one instance group. This means that you can't add additional subnets into the master instance group. In the following example, we'll resize the master count from 1 to 2.

In this recipe, we only make the master count 1. In the real world, the recommended way is to deploy masters to at least two availability zones and have three masters per zone (one kops instance group). You can achieve that via the --master-count and --master-zones parameters when launching the cluster.

Now take a look at the following command:

# kops edit ig master-us-east-1a
apiVersion: kops/v1alpha2
kind: InstanceGroup
metadata:
creationTimestamp: 2018-04-14T19:06:47Z
labels:
kops.k8s.io/cluster: k8s-cookbook.net
name: master-us-east-1a
spec:
image: kope.io/k8s-1.8-debian-jessie-amd64-hvm-ebs-2018-02-08
machineType: t2.small
maxSize: 1
minSize: 1
nodeLabels:
kops.k8s.io/instancegroup: master-us-east-1a
role: Master
subnets:
- us-east-1a

Before applying the change, we can run the update cluster command without --yes in the dry run mode:

# kops update cluster k8s-cookbook.net
...
Will modify resources:
AutoscalingGroup/master-us-east-1a.masters.k8s-cookbook.net
MinSize 1 -> 2
MaxSize 1 -> 2
Must specify --yes to apply changes

After we verify the dry run message as expected, we can perform the update as follows. In this case, we'll have to perform a rolling update.

How to know whether a rolling update is needed
If we didn't run a kops rolling update in the preceding example, kops will show a validation error when running the kops validate cluster:
VALIDATION ERRORS
KIND                NAME                          MESSAGE
InstanceGroup     master-us-east-1a InstanceGroup master-us-east-1a did not have enough nodes 1 vs 2

Remember to replace k8s-cookbook.net with your cluster name.

# kops update cluster k8s-cookbook.net –-yes && kops rolling-update cluster
...
Using cluster from kubectl context: k8s-cookbook.net
NAME STATUS NEEDUPDATE READY MIN MAX NODES
master-us-east-1a Ready 0 2 2 2 1
nodes Ready 0 3 3 3 3
No rolling-update required.

Just like modifying nodes, we can use both kubectl get nodes and kops validate cluster to check whether the new master has joined the cluster.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.118.186.143