Kubernetes Client Tool Launched in Container
Event Information
Meaning
- Indicates that a Kubernetes client tool was launched inside a container within the cluster, which could potentially be a security concern.
- It is important to investigate the source and purpose of this tool to ensure it complies with security policies and standards.
- To further analyze this event, you can use kubectl to inspect the pod where the tool was launched:
Remediation
- Create a Kubernetes Pod manifest file with a Python container that includes the necessary Python Kubernetes API library.
- Use a Kubernetes ServiceAccount with appropriate RBAC permissions to interact with the Kubernetes API.
kubectl get pod <pod_name> -n <namespace> -o jsonpath="{.spec.serviceAccountName}"
- List the RBAC roles bound to the service account to ensure no unauthorized access is possible:
kubectl get rolebinding,clusterrolebinding -A --field-selector metadata.name=<service-account>
- Modify the container’s security context to prevent unauthorized execution of administrative commands:
- Implement network policies to restrict access to the Kubernetes API server from containers that do not need it.
- Write a Python script that uses the Kubernetes API to list and delete the offending Pod(s) based on the event criteria.