apiVersion: v1 kind: Namespace metadata: name: helloapp --- apiVersion: v1 kind: Service metadata: name: go-example namespace: helloapp spec: selector: app: go-example ports: - port: 8800 targetPort: 8800 type: LoadBalancer --- apiVersion: apps/v1 kind: Deployment metadata: name: go-example namespace: helloapp spec: selector: matchLabels: app: go-example replicas: 3 template: metadata: labels: app: go-example spec: containers: - name: go-example image: harbor.0orz.top/go-example/go-example:8edf753f471878fd5b0e9acbaa1022ccede4d9da imagePullPolicy: IfNotPresent resources: requests: memory: "5Mi" cpu: "10m" limits: memory: "50Mi" cpu: "100m" ports: - containerPort: 8800 volumeMounts: - name: config-volume mountPath: /config - name: helloapp-test-key mountPath: /certs command: ["/helloapp"] args: ["-f", "/config/.linux-config.yaml"] volumes: - name: config-volume configMap: name: go-example-config - name: helloapp-test-key secret: secretName: helloapp-test-key # 需要事先创建该 Secret --- apiVersion: v1 kind: ConfigMap metadata: name: go-example-config namespace: helloapp data: .linux-config.yaml: | server: port: 8800 certs: testKeyPath: /certs/test.key