Ensure that secrets are mounted as files, not environment variables in order to reduce the risk of unauthorized exposure and gain the benefit of automatic updates without requiring a pod restart.
Kubernetes offers two methods for handling secrets: mounting them as data volumes (files) or injecting them as environment variables. Mounting secrets as files is the preferred method because environment variables can be easily exposed through simple debugging tools or system files. Also, mounted volume secrets can be updated dynamically by the cluster, meaning the application can access the new secret value without the overhead and downtime associated with restarting the entire pod.
Audit
To determine if the containers are permitted to operate with the "securityContext.privileged" flag set to true, perform the following operations:
Remediation / Resolution
To implement the Principle of Least Privilege (POLP), replace all uses of the wildcard (∗) in Roles and ClusterRoles with explicitly defined resources, verbs, and apiGroups. This will ensure that principals only possess the exact permissions necessary to perform their specific functions, thus preventing accidental or malicious privilege escalation.
References
- Oracle Cloud Infrastructure Documentation
- Overview of Kubernetes Engine (OKE)
- Managing Kubernetes Clusters
- Setting Up Cluster Access
- Accessing a Cluster Using Kubectl
- About Access Control and Kubernetes Engine (OKE)
- Example: Installing Calico and Setting Up Network Policies
- Oracle Cloud Infrastructure CLI Documentation
- compartment list
- cluster list
- cluster create-kubeconfig
- Kubernetes Documentation
- Secrets