반응형
multi-container Pod 생성
multi-container Pod : 여러개의 컨테이너로 구성된 Pod를 동작
create pod
- 작업 클러스터 : hk8s
- Create a pod name lab004 with 3 containers running, nginx, redis, memcached
# 작업 클러스터 변경
kubectl config use-text hk8s
# yaml 파일 생성
kubectl run lab004 --image=nginx --dry-run=client -o yaml
apiVersion: v1
kind: Pod
metadata:
creationTimestamp: null
labels:
run: lab004
name: lab004
spec:
containers:
- image: nginx
name: lab004
resources: {}
dnsPolicy: ClusterFirst
restartPolicy: Always
status: {}
kubectl run lab004 --image=nginx --dry-run=client -o yaml > multi.yaml
vi multi.yaml
apiVersion: v1
kind: Pod
metadata:
name: lab004
spec:
containers:
- image: nginx
name: nginx
- image: redis
name: redis
- image: memcached
name: memcached
# pod 실행
kubectl apply -f multi.yaml
pod/lab004 created
# pod 실행 확인
kubectl get pods
NAME READY STATUS RESTARTS AGE
lab004 3/3 Running 0 3m3s
kubectl describe pod lab004
.....
Events:
Type Reason Age From Message
---- ------ ---- ---- -------
Normal Scheduled 24m default-scheduler Successfully assigned default/lab004 to node2.example.com
Normal Pulling 24m kubelet Pulling image "nginx"
Normal Pulled 23m kubelet Successfully pulled image "nginx" in 1m0.394469503s
Normal Created 23m kubelet Created container nginx
Normal Started 23m kubelet Started container nginx
Normal Pulling 23m kubelet Pulling image "redis"
Normal Pulled 22m kubelet Successfully pulled image "redis" in 55.891927879s
Normal Created 22m kubelet Created container redis
Normal Started 22m kubelet Started container redis
Normal Pulling 22m kubelet Pulling image "memcached"
Normal Pulled 22m kubelet Successfully pulled image "memcached" in 29.051193886s
Normal Created 22m kubelet Created container memcached
Normal Started 22m kubelet Started container memcached
[참고]
- 유투브 따배시
반응형
'자격증 > CKA' 카테고리의 다른 글
[CKA] Deployment & Pod Scale (0) | 2023.03.14 |
---|---|
[CKA] Side-car Container Pod 실행 (0) | 2023.03.12 |
[CKA] Static Pod 생성 (0) | 2023.03.05 |
[CKA] Pod 생성하기 (0) | 2023.03.04 |
[CKA] ETCD Backup&Restore (0) | 2023.02.26 |