apiVersion: apps/v1
kind: Deployment
metadata:
  name: nginx-tls
spec:
  replicas: 1
  selector:
    matchLabels:
      app: nginx-tls
  template:
    metadata:
      labels:
        app: nginx-tls
      annotations:
        vault.hashicorp.com/agent-inject: "true"
        vault.hashicorp.com/agent-inject-secret-server.cert: "pki_int/issue/example-dot-ru"
        vault.hashicorp.com/agent-inject-template-server.cert: |
          {{- with secret "pki_int/issue/example-dot-ru" "common_name=otus.example.ru" -}}
          {{ .Data.certificate }}
          {{- end }}
        vault.hashicorp.com/agent-inject-secret-server.key: "pki_int/issue/example-dot-ru"
        vault.hashicorp.com/agent-inject-template-server.key: |
          {{- with secret "pki_int/issue/example-dot-ru" "common_name=otus.example.ru" -}}
          {{ .Data.private_key }}
          {{- end }}
        vault.hashicorp.com/role: "otus"
        vault.hashicorp.com/tls-skip-verify: "true"
        vault.hashicorp.com/service: "https://vault:8200"
    spec:
      serviceAccountName: vault-auth
      containers:
      - name: nginx-tls
        image: nginx
        ports:
        - containerPort: 443
        volumeMounts:
          - mountPath: /etc/nginx
            
            name: nginx-conf
      volumes:
      - name: nginx-conf
        configMap:
          name: nginx-conf
          items:
            - key: nginx.conf
              path: nginx.conf