apiVersion: apps/v1 kind: Deployment metadata: name: prometheus namespace: monitoring spec: replicas: 1 selector: matchLabels: app: prometheus template: metadata: labels: app: prometheus spec: # 모니터링 워커 노드 한 곳에만 올리고 싶으면 유지 nodeName: rpi-worker-monitor containers: - name: prometheus image: prom/prometheus:latest args: - "--config.file=/etc/prometheus/prometheus.yml" - "--storage.tsdb.path=/prometheus" - "--web.enable-lifecycle" ports: - containerPort: 9090 volumeMounts: - name: prometheus-config mountPath: /etc/prometheus - name: prometheus-data mountPath: /prometheus volumes: - name: prometheus-config configMap: name: prometheus-config - name: prometheus-data emptyDir: {} # 테스트 용; 나중에 PVC로 바꿔도 됨 --- apiVersion: v1 kind: Service metadata: name: prometheus namespace: monitoring spec: selector: app: prometheus type: NodePort ports: - port: 9090 # ClusterIP 기준 targetPort: 9090 nodePort: 30100 # 외부에서 접근할 때 쓸 NodePort (30000~ 범위)