Terminology
Kubelets : its job is to run the pods and keep them running. Kubelets check for the manifest files in the watched directory and creates/destroys pods accordingly. Kubelets serve a read-only view at the port 10255 and also has /healthz
endpoint to know the health status.
Pod : collection of containers that have the same IP and can share volume.
API Server : Kubernetes stores all its cluster state in etcd and API server only can access it. All other components must pass through API server to access the state.
Security context: Using this we can configure the security settings of the containers and the apps running in it. Some features are running the apps in the pods as a non-root user, giving certain capabilities without granting root access,
Kubernetes on GCP:
To get all the nodes:
|
|
To SSH into nodes:
|
|
Create k8s cluster via commandline:
|
|
To configure the local kubectl with the creds to access the k8s:
|
|
To get the manifest file of existing pod:
|
|
To edit the manifest file of existing pod:
|
|
To view the secrets in the kubernetes cluster:
|
|
To get the secrets in the kubernetes cluster:
|
|
To delete a secret:
|
|
To get the security context of the pods: (Please install yq using pip install yq)
|
|
StackDriver Logging filters:
To see all the failed authentication attempts :
|
|
Get all the requests which k8s decided to forbid:
|
|
Get all the requests which were forbidden:
|
|
GCP Audit Logging Notes
k8s_cluster
– Kubernetes Cluster (k8s API server – pods, deployments, secrets)
gke_cluster
– GKE Cluster Operations (k8s engine API server – cluster creation and deletion)
Others:
Helm is a package manager for k8s. Watch the following video for more details:
References:
- http://kamalmarhubi.com/blog/2015/08/27/what-even-is-a-kubelet/
- http://kamalmarhubi.com/blog/2015/09/06/kubernetes-from-the-ground-up-the-api-server/
- Kubernetes Auditing Official docs : https://kubernetes.io/docs/tasks/debug-application-cluster/audit/
- K8s Secrets : https://kubernetes.io/docs/concepts/configuration/secret/
- K8s Security context of pod : https://kubernetes.io/docs/tasks/configure-pod-container/security-context/