반응형
Pod 생성하기
- 클러스터 : kubernetes-admin@kubernetes
- 새로운 네임스페이스 생성 및 네임스페이스에 포드 생성
. namespace name : ecommerce
. pod Name : eshop-main
. image : nginx:1.17
. env : DB=mysql
# kubectl config use-context kubernetes-admin@kubernetes
Switched to context "kubernetes-admin@kubernetes".
# kubectl create namespace ecommerce
namespace/ecommerce created
# kubectl get namespaces
NAME STATUS AGE
default Active 100d
ecommerce Active 6s
kube-node-lease Active 100d
kube-public Active 100d
kube-system Active 100d
# kubectl run eshop-main --image=nginx:1.17 --env=DB=mysql --dry-run=client
pod/eshop-main created (dry run)
# kubectl run eshop-main --image=nginx:1.17 --env=DB=mysql --namespace ecommerce --dry-run=client -o yaml
apiVersion: v1
kind: Pod
metadata:
creationTimestamp: null
labels:
run: eshop-main
name: eshop-main
namespace: ecommerce
spec:
containers:
- env:
- name: DB
value: mysql
image: nginx:1.17
name: eshop-main
resources: {}
dnsPolicy: ClusterFirst
restartPolicy: Always
status: {}
# kubectl run eshop-main --image=nginx:1.17 --env=DB=mysql --namespace ecommerce
pod/eshop-main created
# kubectl get pod --namespace ecommerce
NAME READY STATUS RESTARTS AGE
eshop-main 1/1 Running 0 8m23s
※ pod 생성하기 전에 --dry-run=client 넣어서 잘 실행되는지와 yaml 형식으로도 이상없는지 확인
[참고]
- 유투브 따배씨
반응형
'자격증 > CKA' 카테고리의 다른 글
[CKA] Deployment & Pod Scale (0) | 2023.03.14 |
---|---|
[CKA] Side-car Container Pod 실행 (0) | 2023.03.12 |
[CKA] multi-container Pod 생성 (0) | 2023.03.05 |
[CKA] Static Pod 생성 (0) | 2023.03.05 |
[CKA] ETCD Backup&Restore (0) | 2023.02.26 |