ur2kunyoung2@cloudshell:~ (username-2023-05-20)$ kubectl get nodes
NAME STATUS ROLES AGE VERSION
gke-cluster-2-default-pool-d83ca680-03ff Ready <none> 75m v1.25.8-gke.500
gke-cluster-2-default-pool-d83ca680-nlr4 Ready <none> 75m v1.25.8-gke.500
gke-cluster-2-default-pool-d83ca680-rlw6 Ready <none> 75m v1.25.8-gke.500
ur2kunyoung2@cloudshell:~ (username-2023-05-20)$ kubectl create deploy tc --image=consol/tomcat-7.0 --replicas=5
deployment.apps/tc created
컨테이너 5개 생성
ur2kunyoung2@cloudshell:~ (username-2023-05-20)$ kubectl expose deploy tc --type=LoadBalancer --port=80 --target-port=8080
service/tc exposed
컨테이너 외부 노출
ur2kunyoung2@cloudshell:~ (username-2023-05-20)$ kubectl get pods,service
NAME READY STATUS RESTARTS AGE
pod/tc-6d45db98df-5rgqw 1/1 Running 0 5m40s
pod/tc-6d45db98df-9srcf 1/1 Running 0 5m40s
pod/tc-6d45db98df-bwgn9 1/1 Running 0 5m40s
pod/tc-6d45db98df-qc4c8 1/1 Running 0 5m40s
pod/tc-6d45db98df-z2nwd 1/1 Running 0 5m40s
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
service/kubernetes ClusterIP 10.48.0.1 <none> 443/TCP 85m
service/tc LoadBalancer 10.48.12.179 34.27.46.199 80:32287/TCP 4m17s
서비스는 포트를 외부로 노출 시키는 기능을 수행
ur2kunyoung2@cloudshell:~ (username-2023-05-20)$ kubectl get pods -owide
NAME READY STATUS RESTARTS AGE IP NODE NOMINATED NODE READINESS GATES
tc-6d45db98df-5rgqw 1/1 Running 0 11m 10.44.2.5 gke-cluster-2-default-pool-d83ca680-03ff <none> <none>
tc-6d45db98df-9srcf 1/1 Running 0 11m 10.44.2.4 gke-cluster-2-default-pool-d83ca680-03ff <none> <none>
tc-6d45db98df-bwgn9 1/1 Running 0 11m 10.44.0.8 gke-cluster-2-default-pool-d83ca680-nlr4 <none> <none>
tc-6d45db98df-qc4c8 1/1 Running 0 11m 10.44.1.5 gke-cluster-2-default-pool-d83ca680-rlw6 <none> <none>
tc-6d45db98df-z2nwd 1/1 Running 0 11m 10.44.1.6 gke-cluster-2-default-pool-d83ca680-rlw6 <none> <none>
파드가 어떤 노드에 거치되어 있는지 확인