Posts

Showing posts from September, 2024

KB:Process Manager (Supervisord/Tini)

Image
The container process manager, often referred to as an "init system" (such as tini or supervisord), is a lightweight and essential component within containerized environments. Acting as the first process (PID 1) in a container, its primary responsibility is to monitor and manage all subsequent processes, ensuring that any child processes are properly started, monitored, and restarted in case of failure. This process manager is critical for maintaining container stability, as it handles important tasks like reaping zombie processes, forwarding system signals, and ensuring that resource consumption remains efficient.  However, it is not considered best practice to run multiple processes within a single container or pod; each pod/container should have a primary init process focused on a single responsibility to align with the principles of containerization, such as process isolation and microservices architecture. References:  https://docs.docker.com/engine/containers/multi-serv...

KB:Kubectl EXPLAIN

Describe fields and structure of various resources. This command describes the fields associated with each supported API resource. Fields are identified via a simple JSONPath identifier: Behind the scenes, kubectl just made an API request to my Kubernetes cluster, grabbed the current Swagger documentation of the API version running in the cluster, and output the documentation and object types. kubectl explain deployment kubectl explain deployment -- recursive kubectl explain deployment.spec.strategy References: https://kubernetes.io/docs/reference/kubectl/generated/kubectl_explain/ https://blog.heptio.com/kubectl-explain-heptioprotip-ee883992a243

KB:Kubernetes ReplicaSet

Image
A ReplicaSet's purpose is to maintain a stable set of replica Pods running at any given time. Usually, you define a Deployment and let that Deployment manage ReplicaSets automatically. --- The reason why the Selector is added to the spec of a Kubernetes ReplicaSet is to allow it to manage Pods that match a specified label, regardless of whether the ReplicaSet itself created them . This is particularly useful because it enables the ReplicaSet to manage Pods that might have been created manually or by another process (assuming they don't already have another controller managing them). As long as the Pods have the same labels that match the ReplicaSet's Selector, the ReplicaSet controller will treat them as its own and manage their lifecycle—ensuring the desired number of replicas is running. This behavior helps the controller maintain the correct state, but it also means care should be taken when using labels to avoid conflicting control over Pods by different controllers. Wh...

KB: Kubectl auto completion setup

kubectl completion Synopsis Output shell completion code for the specified shell (bash, zsh, fish, or powershell). The shell code must be evaluated to provide interactive completion of kubectl commands. This can be done by sourcing it from the .bash_profile. Detailed instructions on how to do this are available here: for macOS: https://kubernetes.io/docs/tasks/tools/install-kubectl-macos/#enable-shell-autocompletion for linux: https://kubernetes.io/docs/tasks/tools/install-kubectl-linux/#enable-shell-autocompletion for windows: https://kubernetes.io/docs/tasks/tools/install-kubectl-windows/#enable-shell-autocompletion Note for zsh users: [1] zsh completions are only supported in versions of zsh >= 5.2. kubectl completion SHELL ref: https://kubernetes.io/docs/reference/kubectl/generated/kubectl_completion/