====== Gerenciar Nós do Cluster Kubernetes ======
===== Criar Token de acesso ao Cluster =====
==== Control Plane ====
$ sudo kubeadm token create --print-join-command --ttl 30m
kubeadm join 177.75.187.212:6443 --token cy0rm8.cz61za05qvqyw4jn --discovery-token-ca-cert-hash sha256:89210ff32f65b5fdbf3f0ad1b08d9cfede402ae16d3ec615b53958d87238c15c
$ sudo kubeadm token list
TOKEN TTL EXPIRES USAGES DESCRIPTION EXTRA GROUPS
cy0rm8.cz61za05qvqyw4jn 29m 2022-04-13T19:25:27Z authentication,signing system:bootstrappers:kubeadm:default-node-token
==== Worker ====
$ sudo kubeadm join 177.75.187.212:6443 --token cy0rm8.cz61za05qvqyw4jn --discovery-token-ca-cert-hash sha256:89210ff32f65b5fdbf3f0ad1b08d9cfede402ae16d3ec615b53958d87238c15c
[sudo] senha para gean:
[preflight] Running pre-flight checks
[preflight] Reading configuration from the cluster...
[preflight] FYI: You can look at this config file with 'kubectl -n kube-system get cm kubeadm-config -o yaml'
[kubelet-start] Writing kubelet configuration to file "/var/lib/kubelet/config.yaml"
[kubelet-start] Writing kubelet environment file with flags to file "/var/lib/kubelet/kubeadm-flags.env"
[kubelet-start] Starting the kubelet
[kubelet-start] Waiting for the kubelet to perform the TLS Bootstrap...
This node has joined the cluster:
* Certificate signing request was sent to apiserver and a response was received.
* The Kubelet was informed of the new secure connection details.
Run 'kubectl get nodes' on the control-plane to see this node join the cluster.
==== Control Plane ====
$ kubectl get nodes
NAME STATUS ROLES AGE VERSION
kube-ctrl-pl-01.juntotelecom.com.br Ready control-plane,master 4d23h v1.23.5
kube-worker-01.juntotelecom.com.br Ready 4d23h v1.23.5
kube-worker-02.juntotelecom.com.br Ready 2m12s v1.23.5
$ kubectl describe node kube-worker-02.juntotelecom.com.br
Name: kube-worker-02.juntotelecom.com.br
Roles:
Labels: beta.kubernetes.io/arch=amd64
beta.kubernetes.io/os=linux
kubernetes.io/arch=amd64
kubernetes.io/hostname=kube-worker-02.juntotelecom.com.br
kubernetes.io/os=linux
Annotations: kubeadm.alpha.kubernetes.io/cri-socket: /var/run/crio/crio.sock
node.alpha.kubernetes.io/ttl: 0
projectcalico.org/IPv4Address: 177.75.187.222/28
projectcalico.org/IPv4VXLANTunnelAddr: 10.85.213.128
projectcalico.org/IPv6Address: 2804:694:4c00:4001::222/64
volumes.kubernetes.io/controller-managed-attach-detach: true
CreationTimestamp: Wed, 13 Apr 2022 15:58:14 -0300
Taints:
Unschedulable: false
Lease:
HolderIdentity: kube-worker-02.juntotelecom.com.br
AcquireTime:
RenewTime: Wed, 13 Apr 2022 16:05:03 -0300
Conditions:
Type Status LastHeartbeatTime LastTransitionTime Reason Message
---- ------ ----------------- ------------------ ------ -------
NetworkUnavailable False Wed, 13 Apr 2022 16:03:35 -0300 Wed, 13 Apr 2022 16:03:35 -0300 CalicoIsUp Calico is running on this node
MemoryPressure False Wed, 13 Apr 2022 16:03:52 -0300 Wed, 13 Apr 2022 16:01:49 -0300 KubeletHasSufficientMemory kubelet has sufficient memory available
DiskPressure False Wed, 13 Apr 2022 16:03:52 -0300 Wed, 13 Apr 2022 16:01:49 -0300 KubeletHasNoDiskPressure kubelet has no disk pressure
PIDPressure False Wed, 13 Apr 2022 16:03:52 -0300 Wed, 13 Apr 2022 16:01:49 -0300 KubeletHasSufficientPID kubelet has sufficient PID available
Ready True Wed, 13 Apr 2022 16:03:52 -0300 Wed, 13 Apr 2022 16:01:59 -0300 KubeletReady kubelet is posting ready status. AppArmor enabled
Addresses:
InternalIP: 177.75.187.222
Hostname: kube-worker-02.juntotelecom.com.br
Capacity:
cpu: 8
ephemeral-storage: 19007740Ki
hugepages-2Mi: 0
memory: 8146848Ki
pods: 110
Allocatable:
cpu: 8
ephemeral-storage: 17517533155
hugepages-2Mi: 0
memory: 8044448Ki
pods: 110
System Info:
Machine ID: d93fdf5c1b994edda71fa55e8f8af2ac
System UUID: 37bc4d56-2733-a97e-1a2e-85be1a063213
Boot ID: e2601442-e546-4b80-b411-b8fa05366e72
Kernel Version: 5.10.0-13-amd64
OS Image: Debian GNU/Linux 11 (bullseye)
Operating System: linux
Architecture: amd64
Container Runtime Version: cri-o://1.23.2
Kubelet Version: v1.23.5
Kube-Proxy Version: v1.23.5
Non-terminated Pods: (3 in total)
Namespace Name CPU Requests CPU Limits Memory Requests Memory Limits Age
--------- ---- ------------ ---------- --------------- ------------- ---
calico-system calico-node-g28sr 0 (0%) 0 (0%) 0 (0%) 0 (0%) 3m15s
calico-system calico-typha-7546d9d47-8mkrm 0 (0%) 0 (0%) 0 (0%) 0 (0%) 3m6s
kube-system kube-proxy-nsmzh 0 (0%) 0 (0%) 0 (0%) 0 (0%) 3m15s
Allocated resources:
(Total limits may be over 100 percent, i.e., overcommitted.)
Resource Requests Limits
-------- -------- ------
cpu 0 (0%) 0 (0%)
memory 0 (0%) 0 (0%)
ephemeral-storage 0 (0%) 0 (0%)
hugepages-2Mi 0 (0%) 0 (0%)
Events:
Type Reason Age From Message
---- ------ ---- ---- -------
Normal Starting kube-proxy
Normal Starting kubelet Starting kubelet.
Normal NodeHasSufficientMemory (x2 over ) kubelet Node kube-worker-02.juntotelecom.com.br status is now: NodeHasSufficientMemory
Normal NodeHasNoDiskPressure (x2 over ) kubelet Node kube-worker-02.juntotelecom.com.br status is now: NodeHasNoDiskPressure
Normal NodeHasSufficientPID (x2 over ) kubelet Node kube-worker-02.juntotelecom.com.br status is now: NodeHasSufficientPID
Normal NodeHasSufficientMemory (x2 over ) kubelet Node kube-worker-02.juntotelecom.com.br status is now: NodeHasSufficientMemory
Normal NodeHasNoDiskPressure (x2 over ) kubelet Node kube-worker-02.juntotelecom.com.br status is now: NodeHasNoDiskPressure
Normal NodeHasSufficientPID (x2 over ) kubelet Node kube-worker-02.juntotelecom.com.br status is now: NodeHasSufficientPID
Normal NodeAllocatableEnforced kubelet Updated Node Allocatable limit across pods
Normal Starting kubelet Starting kubelet.
Normal NodeReady kubelet Node kube-worker-02.juntotelecom.com.br status is now: NodeReady