apiVersion: v1 kind: ConfigMap metadata: name: script-config namespace: default labels: app: script-exporter data: test.sh: | echo "abcd{number=\"1\"} 1" --- apiVersion: apps/v1 kind: Deployment metadata: annotations: {} name: script-exporter namespace: default labels: name: script-exporter spec: replicas: 1 selector: matchLabels: name: script-exporter template: metadata: labels: app: script-exporter name: script-exporter spec: containers: - name: script-exporter #image: harbor.uenpay.com/base/script-exporter:v1 image: registry.cn-hangzhou.aliyuncs.com/zhengyu1992/script-exporter:v1 #imagePullPolicy: IfNotPresent imagePullPolicy: Always env: - name: script_path #"默认目录 /shell",下面目录也要跟着改 value: "/shell" - name: timeout_time #默认30s value: "30" readinessProbe: tcpSocket: port: 29001 initialDelaySeconds: 10 periodSeconds: 10 timeoutSeconds: 5 failureThreshold: 2 successThreshold: 1 livenessProbe: tcpSocket: port: 29001 initialDelaySeconds: 10 periodSeconds: 10 timeoutSeconds: 5 failureThreshold: 2 successThreshold: 1 ports: - containerPort: 29001 protocol: TCP volumeMounts: - name: script-all mountPath: /shell restartPolicy: Always terminationGracePeriodSeconds: 60 securityContext: runAsUser: 0 volumes: - name: script-all configMap: name: script-config strategy: type: RollingUpdate rollingUpdate: maxUnavailable: 50% maxSurge: 1 revisionHistoryLimit: 7 progressDeadlineSeconds: 600 --- apiVersion: v1 kind: Service metadata: name: script-exporter namespace: default spec: ports: - name: web port: 29001 protocol: TCP targetPort: 29001 selector: app: script-exporter name: script-exporter