apiVersion: v1
kind: Pod
metadata:
  labels:
    app: etcd
  name: etcd-root-client
  namespace:
spec:
  containers:
  - command:
    - sleep
    - infinity
    env:
    - name: POD_NAMESPACE
      valueFrom:
        fieldRef:
          fieldPath: metadata.namespace    
    - name: ETCDCTL_ENDPOINTS
      value: https://etcd-server.$(POD_NAMESPACE).svc.cluster.local:2379
    - name: ETCDCTL_CACERT
      value: /opt/certs/ca/ca.crt
    - name: ETCDCTL_CERT
      value: /opt/certs/root-certs/tls.crt
    - name: ETCDCTL_KEY
      value: /opt/certs/root-certs/tls.key
    image: quay.io/coreos/etcd:v3.5.1
    imagePullPolicy: IfNotPresent
    name: etcd-client
    resources: {}
    volumeMounts:
    - name: root-certs
      mountPath: /opt/certs/root-certs
    - name: ca
      mountPath: /opt/certs/ca     
  volumes:
  - name: root-certs
    secret:
      secretName: root-client-certs
  - name: ca
    secret:
      secretName: etcd-certs
