bash 쉘을 가진 simple-http python 컨테이너 구동
docker run -d --name debian debian /bin/bash -c "echo 'Start'; sleep infinity"
docker exec -it debian /bin/bash
-------
Pod에 접속해서 간단하게 네트워크 등을 점검하고자 할 때
kubectl get pods 로 POD_ID 확인 후
kubectl exec -it POD_ID /bin/bash
---
apiVersion: apps/v1
kind: Deployment
metadata:
labels:
run: simple-http-app # Label for the Deployment
name: simple-http-app # Name of Deployment
spec:
selector:
matchLabels:
run: simple-http-app
template: # Pod template
metadata:
labels:
run: simple-http-app # Labels Pods from this Deployment
spec:
containers:
- name: simple-http
image: python:2.7
imagePullPolicy: IfNotPresent
command: ["/bin/bash"]
args: ["-c", "echo \"<p>Hello1 from $(hostname)</p>\" > index.html; python -m SimpleHTTPServer 6000"]
ports:
- name: http2
containerPort: 6000