티스토리 뷰

728x90

pv pvc 예시

apiVersion: v1
kind: PersistentVolume
metadata:
  name: plugin-repo-pv
spec:
  capacity:
    storage: 1Gi
  accessModes:
    - ReadOnlyMany
  hostPath:
    path: /home/ubuntu/plugin-repo # 실제 노드 디렉토리
---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  name: plugin-repo-pvc
spec:
  accessModes:
    - ReadOnlyMany
  resources:
    requests:
      storage: 1Gi
  volumeName: plugin-repo-pv

nginx http 예

apiVersion: v1
kind: Pod
metadata:
  name: plugin-http
  labels:
    app: plugin-http
spec:
  containers:
    - name: nginx
      image: nginx:alpine
      ports:
        - containerPort: 80
      volumeMounts:
        - name: plugin-volume
          mountPath: /usr/share/nginx/html
          readOnly: true
  volumes:
    - name: plugin-volume
      persistentVolumeClaim:
        claimName: plugin-repo-pvc
---
apiVersion: v1
kind: Service
metadata:
  name: plugin-http
spec:
  selector:
    app: plugin-http
  ports:
    - port: 80
      targetPort: 80

 

initcontainer  예시

apiVersion: apps/v1
kind: Deployment
metadata:
  name: kafka-connect
spec:
  replicas: 1
  selector:
    matchLabels:
      app: kafka-connect
  template:
    metadata:
      labels:
        app: kafka-connect
    spec:
      volumes:
        - name: plugin-volume
          emptyDir: {}  # initContainer와 공유할 임시 볼륨

      initContainers:
        - name: init-download-plugin
          image: curlimages/curl:latest
          command: ["sh", "-c"]
          args:
            - >
              echo "⬇️ Downloading plugin..." &&
              curl -fSL http://plugin-http.default.svc.cluster.local/my-custom-plugin.jar -o /plugins/my-custom-plugin.jar &&
              echo "✅ Download complete"
          volumeMounts:
            - name: plugin-volume
              mountPath: /plugins

      containers:
        - name: kafka-connect
          image: confluentinc/cp-kafka-connect:latest
          env:
            - name: CONNECT_PLUGIN_PATH
              value: "/usr/share/java,/plugins"  # 다운로드된 경로 포함
            - name: CONNECT_BOOTSTRAP_SERVERS
              value: "your-kafka:9092"
            - name: CONNECT_REST_PORT
              value: "8083"
          ports:
            - containerPort: 8083
          volumeMounts:
            - name: plugin-volume
              mountPath: /plugins

 

 

728x90

'기타' 카테고리의 다른 글

Kafka Connect의 구성(config) 백업  (0) 2025.04.18
Apache APISIX의 환경 설정값을 백업  (0) 2025.04.18
HTTP 헤더란?  (0) 2025.04.18
서비스 기획 vs 개발 기획 비교  (0) 2025.04.18
개발 기획이란?  (0) 2025.04.18
250x250
공지사항
최근에 올라온 글
최근에 달린 댓글
Total
Today
Yesterday
링크
TAG
more
«   2025/04   »
1 2 3 4 5
6 7 8 9 10 11 12
13 14 15 16 17 18 19
20 21 22 23 24 25 26
27 28 29 30
글 보관함