Cloud & Virtualization

bash 쉘을 가진 simple-http python 컨테이너 구동

silentbrain 2021. 4. 19. 09:30

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

 

---

apiVersionapps/v1

kindDeployment

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:

      - namesimple-http

        imagepython:2.7

        imagePullPolicyIfNotPresent

        command: ["/bin/bash"]

        args: ["-c""echo \"<p>Hello1 from $(hostname)</p>\" > index.html; python -m SimpleHTTPServer 6000"]

        ports:

        - namehttp2

          containerPort6000