Description
For the peer connections etcd uses for replication and consensus, configure each member’s peer certificate and matching private key. Members use those certificates to verify one another.
Potential impact
An unprotected connection exposes replicated data to disclosure or modification. An expired certificate or mismatched key can interrupt communication between members.
Remediation
- Set
--peer-cert-fileand--peer-key-fileand restrict who can read the key. Use HTTPS for the peer listen and advertised URLs. - Verify peer certificates with
--peer-trusted-ca-fileand--peer-client-cert-auth. Check that each certificate’s subject alternative names (SANs) include the hostname or IP address peers use to connect. Renew the certificate before it expires. - After the change, check member connectivity and cluster health. Review TLS for client connections separately.
Examples
These excerpts show etcd 3.2.18 arguments. For a deployment on a supported version, also configure the file mounts and peer URLs.
Before
yaml
apiVersion: apps/v1
kind: Deployment
metadata:
name: app-etcd-deployment
spec:
template:
spec:
containers:
- name: database
image: gcr.io/google_containers/etcd:v3.2.18
command:
- "etcd"
args:
- "--peer-cert-file=/etc/env/file.crt"
After
yaml
apiVersion: apps/v1
kind: Deployment
metadata:
name: app-etcd-deployment
spec:
template:
spec:
containers:
- name: database
image: gcr.io/google_containers/etcd:v3.2.18
command:
- "etcd"
args:
- "--peer-cert-file=/etc/env/file.crt"
- "--peer-key-file=/etc/env/file2.key"
The second excerpt adds the path to the private key for the existing peer certificate.