Kubernetes

쿠버네티스 ( masternode에 k8snode2 가입하기)

law and security 2024. 10. 7. 17:30

 

 

토큰 생성 하고 조인할 node에 넣으면 된다. 
node2에도 파드가 생성되게 할 수 있다. 

 

 

[root@k8smaster ~]# jmeter
[1] 12767
[root@k8smaster bin]# k get pods
NAME                        READY   STATUS    RESTARTS        AGE
guestbook-8dcc5b86f-5r67l   1/1     Running   2 (5m24s ago)   25m
guestbook-8dcc5b86f-8qj2n   1/1     Running   0               80s
guestbook-8dcc5b86f-g66c4   1/1     Running   0               80s
guestbook-8dcc5b86f-pqf9p   1/1     Running   0               65s
guestbook-8dcc5b86f-wvv6w   1/1     Running   0               80s
[root@k8smaster bin]# kubeadm token create --print-join-command
kubeadm join 192.168.56.100:6443 --token 918hvr.i5yqfj4ibswn72us --discovery-token-ca-cert-hash sha256:392473bb132363624b9ae82c6417b72b34aa6c5ebe8d64e9b321f2c61cb315bf
[root@k8smaster bin]# ssh k8snode2
Last login: Wed Sep 25 18:08:46 2024 from 192.168.56.1
[root@k8snode2 ~]# exit
logout
Connection to k8snode2 closed.

 

 

 

* node2 

[root@k8snode2 ~]# kubeadm join 192.168.56.100:6443 --token 918hvr.i5yqfj4ibswn72us --discovery-token-ca-cert-hash sha256:392473bb132363624b9ae82c6417b72b34aa6c5ebe8d64e9b321f2c61cb315bf

 

 

*  k8master 에서 

[root@k8smaster bin]# k taint nodes k8smaster node-role.kubernetes.io/control-plane:NoSchedule
node/k8smaster tainted
[root@k8smaster bin]# k delete all --all
pod "guestbook-8dcc5b86f-5r67l" deleted
service "guestbook-nodeport" deleted
service "kubernetes" deleted
deployment.apps "guestbook" deleted
replicaset.apps "guestbook-8dcc5b86f" deleted
horizontalpodautoscaler.autoscaling "guestbook" deleted
[root@k8smaster bin]# cd ~/lab/14
[root@k8smaster 14]# ls
deployment.yaml  hpa.yaml  방명록_부하테스트.jmx  service-nodeport.yaml
[root@k8smaster 14]# k create -f deployment.yaml
deployment.apps/guestbook created
[root@k8smaster 14]# k get pods -o wide
NAME                        READY   STATUS              RESTARTS   AGE   IP              NODE       NOMINATED NODE   READINESS GATES
guestbook-8dcc5b86f-h9lvf   1/1     Running             0          9s    10.102.249.39   k8snode1   <none>           <none>
guestbook-8dcc5b86f-kgxr8   1/1     Running             0          9s    10.102.249.35   k8snode1   <none>           <none>
guestbook-8dcc5b86f-qqn6j   0/1     ContainerCreating   0          9s    <none>          k8snode2   <none>           <none>

 

'Kubernetes' 카테고리의 다른 글

웹 게시판 소스코드를 파드로 디폴리먼트  (0) 2024.10.14
쿠버네티스 (Virtual box-ubuntu)  (0) 2024.10.10
쿠버네티스 (AutoScaling  (0) 2024.10.07
쿠버네티스 ( secret)  (0) 2024.10.07
쿠버네티스 (ConfigMap)  (0) 2024.10.04