[ Pod ]
☆ Pod 를 만들어보자 ☆
● go-http-pod.yaml 작성
# gedit go-http-pod.yaml
apiVersion: v1
kind: Pod
metadata:
name: http-go
spec:
containers:
- name: http-go
image: nuy0307/http-go
ports:
- containerPort: 8080
● 파드 생성 & 확인
# 생성
kubectl create -f go-http-pod.yaml
# 파드 상태 확인
kubectl get pod http-go
# 자세한 정보 출력
kubectl get pod http-go -o wide
# 작성된 내용 확인
kubectl get pod http-go -o yaml
# json 형식으로 작성된 내용 확인
kubectl get pod http-go -o json
# 생성 시간 & 진행 상황 확인
kubectl describe pod http-go
● 주석 달기
# 주석 달기
kubectl annotate pod http-go testanno=test^^
# 확인
kubectl get pod http-go -o yaml
● 삭제
# 특정 파드 삭제
kubectl delete -f go-http-pod.yaml
# 모든 파드 삭제
kubectl delete pod --all
☆ Jenkins Pod 를 만들어보자 ☆
● jenkins-manual-pod.yaml 작성
# gedit jenkins-manual-pod.yaml
apiVersion: v1
kind: Pod
metadata:
name: jenkins-manual
spec:
containers:
- name: jenkins
image: jenkins/jenkins
ports:
- containerPort: 8080
● 파드 생성 및 확인
# 파드 생성
kubectl create -f jenkins-manual-pod.yaml
# 실시간 상태 확인 : -w 옵션
kubectl get pod -w
# exec & curl 옵션으로 확인
kubectl exec jenkins-manual -- curl 127.0.0.1:8080 -s
● 포트포워딩 후 Firefox 웹 브라우저 접속
kubectl port-forward jenkins-manual 8888:8080
》 kubectl logs jenkins-manual 명령어로 admin 암호 확인 가능
● 내용 확인
# yaml 내용 확인
kubectl get pod jenkins-manual -o yaml
# 상세 정보 확인
kubectl describe pod jenkins-manual
'CLOUD > Docker&Kubernetes' 카테고리의 다른 글
[Kubernetes/Ubuntu] 쿠버네티스 환경 구축하기 (2) | 2023.05.13 |
---|---|
[Kubernetes] K8S 구조 - K8S 네트워크 (0) | 2023.05.03 |
[Kubernetes] K8S 구조 - K8S 컴포넌트 (0) | 2023.05.03 |
[Kubernetes] Namespace (0) | 2023.05.01 |
[Kubernetes] MSA 실습하기 - Admin & Main MSA (0) | 2023.04.28 |