Back to Checks
API server pod has the --etcd-cafile argument set
apiserver_etcd_cafile_set
Service: apiserverSeverity: critical
OfficialBuilt-inVerified
Categories:encryptioncluster-security
Resource Type:Pod
Kubernetes API server uses an etcd CA file via --etcd-cafile to verify etcd's TLS certificate.
This evaluates whether API server containers specify that CA file, anchoring TLS trust for etcd connections.
Risk
Without a validated etcd CA, the API server may accept rogue or intercepted endpoints, undermining:
- Confidentiality: exposure of cluster data in transit
- Integrity: tampering with Kubernetes state in etcd
- Availability: control plane disruption via malicious etcd responses
Run this check with Prowler
Run in Prowler CloudRun
prowler kubernetes --checks apiserver_etcd_cafile_setRecommendation
Anchor etcd connections in mutual TLS: provide a trusted CA (--etcd-cafile) and unique client credentials, rotate keys, and prefer strong ciphers.
Apply least privilege and network segmentation so only API servers can reach etcd; disable plaintext or unauthenticated access.
Remediation
Other
1SSH to the control plane node running kube-apiserver
2Edit /etc/kubernetes/manifests/kube-apiserver.yaml
3In spec.containers[0].command, add the flag line:
4```
5- --etcd-cafile=/etc/kubernetes/pki/etcd/ca.crt
6```
7Save the file; the kubelet will restart the API server automatically
Check Code
from prowler.lib.check.models import Check, Check_Report_Kubernetes
from prowler.providers.kubernetes.services.apiserver.apiserver_client import (
apiserver_client,
)
class apiserver_etcd_cafile_set(Check):
def execute(self) -> Check_Report_Kubernetes:
findings = []
for pod in apiserver_client.apiserver_pods:
report = Check_Report_Kubernetes(metadata=self.metadata(), resource=pod)
report.status = "PASS"
report.status_extended = (
f"etcd CA file is set appropriately in pod {pod.name}."
)
etcd_cafile_set = True
for container in pod.containers.values():
# Check if "--etcd-cafile" is set
if "--etcd-cafile" not in str(container.command):
etcd_cafile_set = False
break
if not etcd_cafile_set:
report.status = "FAIL"
report.status_extended = f"etcd CA file is not set in pod {pod.name}."
findings.append(report)
return findings