Kubernetes – busybox 생성하기

By | 2022년 12월 6일
Table of Contents

Kubernetes – busybox 생성하기

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

심플 버전

busybox.yaml

vi busybox.yaml
---------------------------
apiVersion: v1
kind: Pod
metadata:
  name: busybox
  namespace: default
spec:
  containers:
  - image: busybox
    command:
      - sleep
      - "3600"
    imagePullPolicy: IfNotPresent
    name: busybox
  restartPolicy: Always
---------------------------
kubectl apply -f busybox.yaml

접속하기

kubectl get pod
kubectl exec -it busybox -- /bin/sh

볼륨 포함

vi busybox-with-volume.yaml
---------------------------
apiVersion: apps/v1
kind: Deployment
metadata:
  name: busybox-with-volume
spec:
  replicas: 1
  selector:
    matchLabels:
      app: init-container-msg-app
  template:
    metadata:
      labels:
        app: init-container-msg-app
    spec:
      containers:
      - command:
          - sleep
          - "3600"
        image: busybox
        name: init-container-msg-container-main
        volumeMounts:
        - name: default-pemstore
          mountPath: /etc/ssl/certs/default.pem
          subPath: rootCA.crt
          readOnly: true
      volumes:
      - name: default-pemstore
        configMap:
          name: default-pemstore
---------------------------
kubectl apply -f busybox-with-volume.yaml

접속하기

kubectl get pod
kubectl exec -it busybox-with-volume-56fd4fd575-wgxgr -- /bin/sh

답글 남기기