Question 14 - Find out Cluster Information
Question 14 | Find out Cluster Information
Use context: kubectl config use-context k8s-c1-H
You're ask to find out following information about the cluster k8s-c1-H: How many controlplane nodes are available? How many worker nodes are available? What is the Service CIDR? Which Networking (or CNI Plugin) is configured and where is its config file? Which suffix will static pods have that run on cluster1-node1? Write your answers into file /opt/course/14/cluster-info, structured like this:
/opt/course/14/cluster-info
1: [ANSWER] 2: [ANSWER] 3: [ANSWER] 4: [ANSWER] 5: [ANSWER]
kubectl config use-context k8s-c1-H
# We can get the nodes and check what we have to answer the first two questions
k get node
NAME STATUS ROLES AGE VERSION
cluster1-controlplane1 Ready control-plane 27h v1.29.0
cluster1-node1 Ready <none> 27h v1.29.0
cluster1-node2 Ready <none> 27h v1.29.0
# 1 control plane and 2 workers
# To check the Service CIDR. These values are the same configured in the static pod inside the manifest /etc/kubernetes/manifest/kube-api.server. We're just avoiding the ssh connection.
kubectl get pod -n kube-system kube-apiserver-cluster1-controlplane1 -o yaml | grep range
- --service-cluster-ip-range=10.96.0.0/12
ssh cluster1-controlplane1
# To see which cni plugin we can ssh in and check in /etc/cni/net.d or
root@cluster1-controlplane1:~# ls -lha /etc/cni/net.d/
10-weave.conflist
# Doing a cat on this file we can see something like
root@cluster1-controlplane1:~# cat /etc/cni/net.d/10-weave.conflist | grep name
"name": "weave",
# The suffix of a static pod is always the node name itself with a - in front.
Inside the file /opt/course/14/cluster-info we need to put the following:
1: 1
2: 3
3: 10.96.0.0/12
4: weave, /etc/cni/net.d/10-weave.conflist
5: -cluster1-controlplane1