< pod 정보 확인 >
-> 현재 pod는 3개 있다.
[root@k8smaster ~]# kubectl get pods
NAME READY STATUS RESTARTS AGE
guestbook-7b5df6f8cd-85kxm 1/1 Running 0 20h
guestbook-7b5df6f8cd-gbgr8 1/1 Running 0 20h
guestbook-7b5df6f8cd-nrk74 1/1 Running 0 20h
[root@k8smaster ~]# cd ~/lab/03
[root@k8smaster 03]# ls
custom-namespace.yaml guestbook-liveness-probe.yaml guestbook-manual.yaml
guestbook-gpu.yaml guestbook-manual-custom-namespace.yaml
guestbook-liveness-probe-initial-delay.yaml guestbook-manual-with-labels.yaml
<pod 삭제 >
[root@k8smaster 03]# kubectl create -f guestbook-manual.yaml
pod/guestbook-manual created
[root@k8smaster 03]# kubectl get pods
NAME READY STATUS RESTARTS AGE
guestbook-7b5df6f8cd-85kxm 1/1 Running 0 20h
guestbook-7b5df6f8cd-gbgr8 1/1 Running 0 20h
guestbook-7b5df6f8cd-nrk74 1/1 Running 0 20h
guestbook-manual 1/1 Running 0 13s
[root@k8smaster 03]# kubectl get replicaset
NAME DESIRED CURRENT READY AGE
guestbook-7b5df6f8cd 3 3 3 45h
[root@k8smaster 03]# kubectl delete pods guestbook-7b5df6f8cd-gbgr8
pod "guestbook-7b5df6f8cd-gbgr8" deleted
[root@k8smaster 03]# kubectl get rs
NAME DESIRED CURRENT READY AGE
guestbook-7b5df6f8cd 3 3 3 45h
[root@k8smaster 03]# kubectl delete rs guestbook-7b5df6f8cd
replicaset.apps "guestbook-7b5df6f8cd" deleted
< ReplicaSet 안에 있는 POD 삭제 >
[root@k8smaster 03]# cd ..
[root@k8smaster lab]# ls
쿠버네티스_설치 02 03 04 05 06 07 08 09 10 11 12 13 14 whatap-demo
[root@k8smaster lab]# cd 02
[root@k8smaster 02]# ls
dashboard metrics-server
[root@k8smaster 02]# kubectl get deployment
NAME READY UP-TO-DATE AVAILABLE AGE
guestbook 3/3 3 3 45h
[root@k8smaster 02]# kubectl delete deployment guestbook
deployment.apps "guestbook" deleted
[root@k8smaster 02]# kubectl get pods
NAME READY STATUS RESTARTS AGE
guestbook-manual 1/1 Running 0 12m
[root@k8smaster 02]#
* deployment를 지워야 ReplicaSet안에 있는 POD들이 삭제된다. ( deployment에 의해 replicaset를 만들었기 때문)
* ReplicaSet 객체로 만들면 replicaset를 삭제하면 pod들도 삭제된다.
[root@k8smaster 02]# kubectl get rs
No resources found in default namespace.
[root@k8smaster 02]# kubectl get pods
NAME READY STATUS RESTARTS AGE
guestbook-manual 1/1 Running 0 19m
[root@k8smaster 02]#
* 수동으로 pod를 만들면 ReplicaSet자체가 없다.
[root@k8smaster 02]# kubectl logs guestbook-manual
. ____ _ __ _ _
/\\ / ___'_ __ _ _(_)_ __ __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
\\/ ___)| |_)| | | | | || (_| | ) ) ) )
' |____| .__|_| |_|_| |_\__, | / / / /
=========|_|==============|___/=/_/_/_/
:: Spring Boot :: (v2.1.6.RELEASE)
2024-09-27 01:56:45.822 INFO 1 --- [ main] c.j.guestbook.GuestbookApplication : Starting GuestbookApplication v0.0.1-SNAPSHOT on guestbook-manual with PID 1 (/app/guestbook.jar started by root in /app)
2024-09-27 01:56:45.825 INFO 1 --- [ main] c.j.guestbook.GuestbookApplication : No active profile set, falling back to default profiles: default
2024-09-27 01:56:47.269 INFO 1 --- [ main] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat initialized with port(s): 8080 (http)
2024-09-27 01:56:47.324 INFO 1 --- [ main] o.apache.catalina.core.StandardService : Starting service [Tomcat]
2024-09-27 01:56:47.325 INFO 1 --- [ main] org.apache.catalina.core.StandardEngine : Starting Servlet engine: [Apache Tomcat/9.0.21]
2024-09-27 01:56:47.433 INFO 1 --- [ main] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring embedded WebApplicationContext
2024-09-27 01:56:47.434 INFO 1 --- [ main] o.s.web.context.ContextLoader : Root WebApplicationContext: initialization completed in 1556 ms
2024-09-27 01:56:47.578 INFO 1 --- [ main] com.zaxxer.hikari.HikariDataSource : HikariPool-1 - Starting...
2024-09-27 01:56:47.855 INFO 1 --- [ main] com.zaxxer.hikari.HikariDataSource : HikariPool-1 - Start completed.
2024-09-27 01:56:48.248 INFO 1 --- [ main] o.s.s.concurrent.ThreadPoolTaskExecutor : Initializing ExecutorService 'applicationTaskExecutor'
2024-09-27 01:56:48.400 INFO 1 --- [ main] o.s.b.a.w.s.WelcomePageHandlerMapping : Adding welcome page template: index
2024-09-27 01:56:48.542 INFO 1 --- [ main] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat started on port(s): 8080 (http) with context path ''
2024-09-27 01:56:48.544 INFO 1 --- [ main] c.j.gu
* kubectl log로 POD의 로그 출력
[root@k8smaster 02]# kubectl logs guestbook-manual -c guestbook
. ____ _ __ _ _
/\\ / ___'_ __ _ _(_)_ __ __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
\\/ ___)| |_)| | | | | || (_| | ) ) ) )
' |____| .__|_| |_|_| |_\__, | / / / /
=========|_|==============|___/=/_/_/_/
:: Spring Boot :: (v2.1.6.RELEASE)
2024-09-27 01:56:45.822 INFO 1 --- [ main] c.j.guestbook.GuestbookApplication : Starting GuestbookApplication v0.0.1-SNAPSHOT on guestbook-manual with PID 1 (/app/guestbook.jar started by root in /app)
2024-09-27 01:56:45.825 INFO 1 --- [ main] c.j.guestbook.GuestbookApplication : No active profile set, falling back to default profiles: default
2024-09-27 01:56:47.269 INFO 1 --- [ main] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat initialized with port(s): 8080 (http)
2024-09-27 01:56:47.324 INFO 1 --- [ main] o.apache.catalina.core.StandardService : Starting service [Tomcat]
2024-09-27 01:56:47.325 INFO 1 --- [ main] org.apache.catalina.core.StandardEngine : Starting Servlet engine: [Apache Tomcat/9.0.21]
2024-09-27 01:56:47.433 INFO 1 --- [ main] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring embedded WebApplicationContext
2024-09-27 01:56:47.434 INFO 1 --- [ main] o.s.web.context.ContextLoader : Root WebApplicationContext: initialization completed in 1556 ms
2024-09-27 01:56:47.578 INFO 1 --- [ main] com.zaxxer.hikari.HikariDataSource : HikariPool-1 - Starting...
2024-09-27 01:56:47.855 INFO 1 --- [ main] com.zaxxer.hikari.HikariDataSource : HikariPool-1 - Start completed.
2024-09-27 01:56:48.248 INFO 1 --- [ main] o.s.s.concurrent.ThreadPoolTaskExecutor : Initializing ExecutorService 'applicationTaskExecutor'
2024-09-27 01:56:48.400 INFO 1 --- [ main] o.s.b.a.w.s.WelcomePageHandlerMapping : Adding welcome page template: index
2024-09-27 01:56:48.542 INFO 1 --- [ main] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat started on port(s): 8080 (http) with context path ''
2024-09-27 01:56:48.544 INFO 1 --- [ main] c.j.guestbook.GuestbookApplication : Started GuestbookApplication in 3.256 seconds (JVM running for 4.061)
* 컨테이너 이름을 지정해서 다중컨테이너 POD의 로그 가져오기
[root@k8smaster 02]# kubectl describe pods guestbook-manual
Name: guestbook-manual
Namespace: default
Priority: 0
Service Account: default
Node: k8snode1/192.168.56.101
Start Time: Fri, 27 Sep 2024 10:56:43 +0900
Labels: <none>
Annotations: cni.projectcalico.org/containerID: 4087d522887f0f959b49904aeb1d760921f085cddede8c8afd78fb6b11be9e05
cni.projectcalico.org/podIP: 10.102.249.18/32
cni.projectcalico.org/podIPs: 10.102.249.18/32
Status: Running
IP: 10.102.249.18
IPs:
IP: 10.102.249.18
Containers:
guestbook:
Container ID: containerd://582a9589711c63f4fa08b70a553ac290e5c427155407473d655f8ff04f324196
Image: yu3papa/k8s_guestbook:1.0
Image ID: docker.io/yu3papa/k8s_guestbook@sha256:e8ae04e606f959ca5f1008e6959d1f3430e3f2ced4cd6688c33efe1a2af4daac
Port: 8080/TCP
Host Port: 0/TCP
State: Running
Started: Fri, 27 Sep 2024 10:56:44 +0900
Ready: True
Restart Count: 0
Environment: <none>
Mounts:
/var/run/secrets/kubernetes.io/serviceaccount from kube-api-access-6lkkp (ro)
Conditions:
Type Status
Initialized True
Ready True
ContainersReady True
PodScheduled True
Volumes:
kube-api-access-6lkkp:
Type: Projected (a volume that contains injected data from multiple sources)
TokenExpirationSeconds: 3607
ConfigMapName: kube-root-ca.crt
ConfigMapOptional: <nil>
DownwardAPI: true
QoS Class: BestEffort
Node-Selectors: <none>
Tolerations: node.kubernetes.io/not-ready:NoExecute op=Exists for 300s
node.kubernetes.io/unreachable:NoExecute op=Exists for 300s
Events:
Type Reason Age From Message
---- ------ ---- ---- -------
Normal Scheduled 24m default-scheduler Successfully assigned default/guestbook-manual to k8snode1
Normal Pulled 24m kubelet Container image "yu3papa/k8s_guestbook:1.0" already present on machine
Normal Created 24m kubelet Created container guestbook
Normal Started 24m kubelet Started container guestbook
* Kubernetes 클러스터에서 guestbook-manual이라는 이름을 가진 파드의 상세 정보를 출력
[root@k8smaster 02]# kubectl get pods guestbook-manual -o wide
NAME READY STATUS RESTARTS AGE IP NODE NOMINATED NODE READINESS GATES
guestbook-manual 1/1 Running 0 40m 10.102.249.18 k8snode1 <none>
<none>
[root@k8smaster 02]# curl 10.102.249.18:8080
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<link href="/common.css" rel="stylesheet">
<link href="/guestbook.css" rel="stylesheet">
<title>방명록 (K8S)</title>
</head>
<body>
<div class="guestbook list displaynone" style="display: block;">
<ul class="cont">
<li>
<p class="memo">
HealthCheck : This is v1 running in pod guestbook-manual (10.102.249.18)
</p>
</li>
</ul>
</div>
<h4 class="g-top">방명록 v1(정환열)</h4>
<div class="top-img">
<img src="/bg-guestbook.jpg">
</div>
<form action="/" method="post" id="frm" enctype="multipart/form-data">
<div class="g-cont">
<ul>
<li class="name"><input name="name" type="text" maxlength="20" placeholder="이름" class="form-control"></li>
<li class="msg"><textarea name="content" maxlength="200" placeholder="내용을 입력해주세요" class="form-control" rows="3"></textarea></li>
<li>파일첨부<input type="file" name="uploadingFile"></li>
</ul>
<p class="btn btn-lg" onclick="document.getElementById('frm').submit();">방명록 남기기</p>
</div>
</form>
<div class="guestbook list displaynone" style="display: block;">
<ul class="cont">
<li>
<p class="name">최유진</p>
<p class="date">2024-09-25 03:43:41</p>
<p class="memo">방명록</p>
첨부파일 : <a href="/downloadFile/null"></a>
</li>
</ul>
</div>
</body>
* 해당하는 pod를 열어봄
[root@k8smaster 02]# kubectl port-forward guestbook-manual 8888:8080
Forwarding from 127.0.0.1:8888 -> 8080
Forwarding from [::1]:8888 -> 8080
Handling connection for 8888
[root@k8smaster ~]# curl localhost:8888
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<link href="/common.css" rel="stylesheet">
<link href="/guestbook.css" rel="stylesheet">
<title>방명록 (K8S)</title>
</head>
<body>
<div class="guestbook list displaynone" style="display: block;">
<ul class="cont">
<li>
<p class="memo">
HealthCheck : This is v1 running in pod guestbook-manual (10.102.249.18)
</p>
</li>
</ul>
</div>
<h4 class="g-top">방명록 v1(정환열)</h4>
<div class="top-img">
<img src="/bg-guestbook.jpg">
</div>
<form action="/" method="post" id="frm" enctype="multipart/form-data">
<div class="g-cont">
<ul>
<li class="name"><input name="name" type="text" maxlength="20" placeholder="이름" class="form-control"></li>
<li class="msg"><textarea name="content" maxlength="200" placeholder="내용을 입력해주세요" class="form-control" rows="3"></textarea></li>
<li>파일첨부<input type="file" name="uploadingFile"></li>
</ul>
<p class="btn btn-lg" onclick="document.getElementById('frm').submit();">방명록 남기기</p>
</div>
</form>
<div class="guestbook list displaynone" style="display: block;">
<ul class="cont">
<li>
<p class="name">최유진</p>
<p class="date">2024-09-25 03:43:41</p>
<p class="memo">방명록</p>
첨부파일 : <a href="/downloadFile/null"></a>
</li>
</ul>
</div>
</body>
[root@k8smaster ~]#
[root@k8smaster ~]# kubectl delete service guestbook-http
service "guestbook-http" deleted
[root@k8smaster ~]# kubectl get services
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
kubernetes ClusterIP 10.96.0.1 <none> 443/TCP 276d
[root@k8smaster ~]#
* 해당 서비스 삭제
미션 1 p.32의 deployment를 통한 배포 -> 파드들의 정보확인 -> rs정보 확인 -> deployment 상세정보 확인 delete: (세션창 추가) watch .... 파드 감시 1) 파드삭제 시도 --> 세션창 정보 확인 2) rs삭제 시도 --> 세션창 정보 확인 3) deployment 삭제 시도 --> 세션창에서 정보 확인 미션 2 : 수동으로 파드 생성 --> localhost포트 포워딩 설정 --> (세션창) localhost:8888 --> 수동파드로 포어딩되었나 확인 미션 3. 추가로 deployment한 pod에 서비스 생성(gestbook-http2)- LoadBalncer타입 --> 서비스 목록 확인 --> 방금 생성된 서비스의 상세정보를 확인 |
미션 1
[root@k8smaster ~]# kubectl delete service guestbook-http
service "guestbook-http" deleted
[root@k8smaster ~]# kubectl get services
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
kubernetes ClusterIP 10.96.0.1 <none> 443/TCP 276d
[root@k8smaster ~]# docker images
REPOSITORY TAG IMAGE ID CREATED PLATFORM SIZE BLOB SIZE
choichoiyj/k8s_guestbook 1.0 90a2e1344a47 2 days ago linux/amd64 554.4 MiB 246.5 MiB
choichoiyujin/k8s_guestbook 1.0 90a2e1344a47 2 days ago linux/amd64 554.4 MiB 246.5 MiB
ubuntu 24.04 dfc10878be8d 2 days ago linux/amd64 81.0 MiB 28.4 MiB
yu3papa/mysql_hangul 2.0 887eb3c63fd4 9 months ago linux/amd64 359.1 MiB 116.9 MiB
[root@k8smaster ~]# kubectl get pods
NAME READY STATUS RESTARTS AGE
guestbook-789b4b9748-vmh9m 1/1 Running 0 19m
guestbook-manual 1/1 Running 0 73m
[root@k8smaster ~]# kubectl get services
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
kubernetes ClusterIP 10.96.0.1 <none> 443/TCP 276d
[root@k8smaster ~]# kubectl expose deployment guestbook --type=LoadBalancer --name guestbook-http
service/guestbook-http exposed
[root@k8smaster ~]# kubectl get services
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
guestbook-http LoadBalancer 10.104.98.114 <pending> 8080:31977/TCP 32s
kubernetes ClusterIP 10.96.0.1 <none> 443/TCP 276d
[root@k8smaster ~]# kubectl get replicasets
NAME DESIRED CURRENT READY AGE
guestbook-789b4b9748 1 1 1 23m
[root@k8smaster ~]# kubectl scale deployment guestbook --replicas=3
deployment.apps/guestbook scaled
[root@k8smaster ~]# kubectl get pods
NAME READY STATUS RESTARTS AGE
guestbook-789b4b9748-bfl4v 1/1 Running 0 13s
guestbook-789b4b9748-jnzms 1/1 Running 0 13s
guestbook-789b4b9748-vmh9m 1/1 Running 0 25m
guestbook-manual 1/1 Running 0 79m
[root@k8smaster ~]# kubectl get po -o wide
NAME READY STATUS RESTARTS AGE IP NODE NOMINATED NODE READINESS GATES
guestbook-789b4b9748-bfl4v 1/1 Running 0 3m41s 10.102.249.25 k8snode1 <none> <none>
guestbook-789b4b9748-jnzms 1/1 Running 0 3m41s 10.102.249.24 k8snode1 <none> <none>
guestbook-789b4b9748-vmh9m 1/1 Running 0 29m 10.102.249.23 k8snode1 <none> <none>
guestbook-manual 1/1 Running 0 83m 10.102.249.18 k8snode1 <none> <none>
1.
[root@k8smaster 03]# kubectl create -f guestbook-manual.yaml
pod/guestbook-manual created
[root@k8smaster templates]# kubectl get pods
NAME READY STATUS RESTARTS AGE
guestbook-789b4b9748-bfl4v 1/1 Running 0 21m
guestbook-789b4b9748-jnzms 1/1 Running 0 21m
guestbook-789b4b9748-vmh9m 1/1 Running 0 47m
guestbook-manual 1/1 Running 0 101m
[root@k8smaster templates]# kubectl get replicaset
NAME DESIRED CURRENT READY AGE
guestbook-789b4b9748 3 3 3 47m
[root@k8smaster templates]# kubectl delete pods guestbook-789b4b9748-bfl4v
pod "guestbook-789b4b9748-bfl4v" deleted
[root@k8smaster templates]# kubectl get rs
NAME DESIRED CURRENT READY AGE
guestbook-789b4b9748 3 3 3 51m
[root@k8smaster templates]# kubectl delete rs guestbook-789b4b9748
replicaset.apps "guestbook-789b4b9748" deleted
2.
[root@k8smaster resources]# kubectl get services
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
guestbook-http LoadBalancer 10.104.98.114 <pending> 8080:31977/TCP 35m
kubernetes ClusterIP 10.96.0.1 <none> 443/TCP 276d
[root@k8smaster resources]# kubectl delete service guestbook-http
service "guestbook-http" deleted
[root@k8smaster resources]# kubectl get services
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
kubernetes ClusterIP 10.96.0.1 <none> 443/TCP 276d
[root@k8smaster resources]#
3.
[root@k8smaster guestbook]# cd ~
[root@k8smaster ~]# cd lab
[root@k8smaster lab]# cd 02
[root@k8smaster 02]# ls
dashboard metrics-server
[root@k8smaster 02]# kubectl get deployment
NAME READY UP-TO-DATE AVAILABLE AGE
guestbook 3/3 3 3 60m
[root@k8smaster 02]# kubectl delete deployment guestbook
deployment.apps "guestbook" deleted
[root@k8smaster 02]# kubectl get pods
NAME READY STATUS RESTARTS AGE
guestbook-manual 1/1 Running 0 115m
[root@k8smaster 02]# kubectl get deployment
No resources found in default namespace.
[root@k8smaster 02]# kubectl get replicaset
No resources found in default namespace.
미션 2. : 수동으로 파드 생성 --> localhost포트 포워딩 설정 --> (세션창) localhost:8888 --> 수동파드로 포어딩되었나 확인
[root@k8smaster 03]# kubectl get pods
No resources found in default namespace.
[root@k8smaster 03]# ls
custom-namespace.yaml guestbook-manual-custom-namespace.yaml
guestbook-gpu.yaml guestbook-manual-with-labels.yaml
guestbook-liveness-probe-initial-delay.yaml guestbook-manual.yaml
guestbook-liveness-probe.yaml
[root@k8smaster 03]# kubectl create -f guestbook-manual.yaml
pod/guestbook-manual created
[root@k8smaster 03]# kubectl get pods
NAME READY STATUS RESTARTS AGE
guestbook-manual 1/1 Running 0 17s
[root@k8smaster 03]# kubectl port-forward guestbook-manual 8888:8080
Forwarding from 127.0.0.1:8888 -> 8080
Forwarding from [::1]:8888 -> 8080
Handling connection for 8888
#다른 세션 창에서
[root@k8smaster ~]#crul localhost:8888
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<link href="/common.css" rel="stylesheet">
<link href="/guestbook.css" rel="stylesheet">
<title>방명록 (K8S)</title>
</head>
<body>
<div class="guestbook list displaynone" style="display: block;">
<ul class="cont">
<li>
<p class="memo">
HealthCheck : This is v1 running in pod guestbook-manual (10.102.249.30)
</p>
</li>
</ul>
</div>
<h4 class="g-top">방명록 v1(정환열)</h4>
<div class="top-img">
<img src="/bg-guestbook.jpg">
</div>
<form action="/" method="post" id="frm" enctype="multipart/form-data">
<div class="g-cont">
<ul>
<li class="name"><input name="name" type="text" maxlength="20" placeholder="이름" class="form-control"></li>
<li class="msg"><textarea name="content" maxlength="200" placeholder="내용을 입력해주세요" class="form-control" rows="3"></textarea></li>
<li>파일첨부<input type="file" name="uploadingFile"></li>
</ul>
<p class="btn btn-lg" onclick="document.getElementById('frm').submit();">방명록 남기기</p>
</div>
</form>
<div class="guestbook list displaynone" style="display: block;">
<ul class="cont">
<li>
<p class="name">최유진</p>
<p class="date">2024-09-25 03:43:41</p>
<p class="memo">방명록</p>
첨부파일 : <a href="/downloadFile/null"></a>
</li>
</ul>
</div>
</body>
</html>[root@k8smaster ~]#
미션 3. 추가로 deployment한 pod에 서비스 생성(gestbook-http2)- LoadBalncer타입
--> 서비스 목록 확인
--> 방금 생성된 서비스의 상세정보를 확인
[root@k8smaster 03]# docker images
REPOSITORY TAG IMAGE ID CREATED PLATFORM SIZE BLOB SIZE
choichoiyj/k8s_guestbook 1.0 90a2e1344a47 2 days ago linux/amd64 554.4 MiB 246.5 MiB
choichoiyujin/k8s_guestbook 1.0 90a2e1344a47 2 days ago linux/amd64 554.4 MiB 246.5 MiB
ubuntu 24.04 dfc10878be8d 2 days ago linux/amd64 81.0 MiB 28.4 MiB
yu3papa/mysql_hangul 2.0 887eb3c63fd4 9 months ago linux/amd64 359.1 MiB 116.9 MiB
[root@k8smaster 03]# kubectl create deployment guestbook --image=choichoiyj/k8s_guestbook:1.0 --port=8080
deployment.apps/guestbook created
[root@k8smaster 03]# kubectl get pods
NAME READY STATUS RESTARTS AGE
guestbook-7c797cc9cc-z5grg 1/1 Running 0 22s
guestbook-manual 1/1 Running 0 13m
[root@k8smaster 03]# kubectl get deployment
NAME READY UP-TO-DATE AVAILABLE AGE
guestbook 1/1 1 1 40s
[root@k8smaster 03]# kubectl expose deployment guestbook --type=LoadBalancer --name guestbook-http2
service/guestbook-http2 exposed
[root@k8smaster 03]# kubectl get services
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
guestbook-http2 LoadBalancer 10.96.73.62 <pending> 8080:30104/TCP 8s
kubernetes ClusterIP 10.96.0.1 <none> 443/TCP 276d
[root@k8smaster 03]# kubectl describe service guestbook-http2
Name: guestbook-http2
Namespace: default
Labels: app=guestbook
Annotations: <none>
Selector: app=guestbook
Type: LoadBalancer
IP Family Policy: SingleStack
IP Families: IPv4
IP: 10.96.73.62
IPs: 10.96.73.62
Port: <unset> 8080/TCP
TargetPort: 8080/TCP
NodePort: <unset> 30104/TCP
Endpoints: 10.102.249.31:8080
Session Affinity: None
External Traffic Policy: Cluster
Events: <none>
'Kubernetes' 카테고리의 다른 글
쿠버네티스 (YAML 디스크립터를 통한 서비스생성) (0) | 2024.09.30 |
---|---|
쿠버네티스 (ReplicationController 의 생성) (0) | 2024.09.30 |
Kubernetes (kubectl을 사용해 POD 만들기) (0) | 2024.09.26 |
쿠버네티스 ( ReplicaSet, Metrics-Server) (0) | 2024.09.26 |
Kubernetes를 이용한 컨테이너 (k8snode1에 GNOME 데스크탑 환경 설치) (0) | 2024.09.25 |