apiVersion: v1
kind: Pod
metadata:
name: hello-app
spec:
containers:
- name: hello-app
image: simon/hello-app:1.0
ports:
- containerPort: 8080
env:
- name: NAME
value: Simon
env:
- name: POD_NAME
valueFrom:
fieldRef:
fieldPath: metadata.name
노드가 생성된 뒤에 환경변수를 설정하므로 valueFrom
을 사용
kubectl apply -f <yaml 파일 경로>
kubectl get pod -o wide
kubectl delete pod --all
kubectl delete pod <pod-name>
kubectl exec <pod-name> [-c <container-name>] --ifconfig eth0
kubectl exec <pod-name> --env
kubectl port-forward <pod-name> <host-port>:<container-port>