Skip to main content

Questão 14 - Informações do Cluster

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
# Podemos pegar os nodes e conferir o que temos para responder as duas primeiras perguntas
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 palane e 2 workers

# Para conferir o Service CIDR. Esses valores são os mesmo configurados no pod static dentro do manifesto /etc/kuberentes/manifest/kube-api.server. Só estamos evitando a conexão ssh.
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
# Para ver qual o plugin cni podemos fazer um ssh para dentor e conferir em /etc/cni/net.d ou
root@cluster1-controlplane1:~# ls -lha /etc/cni/net.d/
10-weave.conflist

# Fazendo um cat nesse arquivo podemos ver algo parecido com
root@cluster1-controlplane1:~# cat /etc/cni/net.d/10-weave.conflist | grep name
"name": "weave",

# O sufixo de um pods estático é sempre o nome do próprio node com um - na frente.

Dentro do arquivo /opt/course/14/cluster-info temos temos que colocar o seguinte:

1: 1
2: 3
3: 10.96.0.0/12
4: weave, /etc/cni/net.d/10-weave.conflist
5: -cluster1-controlplane1