Updating nodes

Using the kops edit command, we can modify the instance type and the node count:

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

In this example, we modify both minSize and maxSize from 2 to 3. After the modification, we'll need to run the kops update to see it take effect:

# kops update cluster k8s-cookbook.net --yes
...
I0414 21:23:52.505171 16291 update_cluster.go:291] Exporting kubecfg for cluster
kops has set your kubectl context to k8s-cookbook.net
Cluster changes have been applied to the cloud.
Changes may require instances to restart: kops rolling-update cluster

Some updates will need a rolling-update cluster. In this example, kops has updated the configuration in the AWS auto scaling group. AWS will then launch a new instance to accommodate the change. The following is a screenshot from AWS Auto Scaling Group's console:

nodes_in_AWS_Auto_Scaling_Groups

We can see that the configuration has been updated, and AWS is scaling a new instance. After few minutes, we can check cluster status via kops validate or kubectl get nodes:

# kops validate cluster
Using cluster from kubectl context: k8s-cookbook.net
Validating cluster k8s-cookbook.net
INSTANCE GROUPS
NAME ROLE MACHINETYPE MIN MAX SUBNETS
master-us-east-1a Master t2.small 1 1 us-east-1a
nodes Node t2.micro 3 3 us-east-1a,us-east-1b,us-east-1c
NODE STATUS
NAME ROLE READY
ip-172-20-119-170.ec2.internal node True
ip-172-20-44-140.ec2.internal node True
ip-172-20-62-204.ec2.internal master True
ip-172-20-87-38.ec2.internal node True

Everything looks good!

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

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