Docker and k8s: Static Pods

Peter Jeon·2023년 5월 4일

Docker and k8s

목록 보기
31/41

Docker and Kubernetes

In this blog post, we will discuss Static Pods in Kubernetes and how they differ from regular pods. This feature allows you to run pods on specific nodes without the need for a full Kubernetes cluster.

What are Static Pods?

Static Pods

Static Pods are a type of Kubernetes Pod that is managed directly by the kubelet on a specific node, without the involvement of the Kubernetes API server. They are used in scenarios where you need to run a pod on a particular node, and the pod should not be managed by the Kubernetes control plane.

How to create Static Pods

To create a Static Pod, you need to add a YAML file to a specific directory on the node that the kubelet watches. The kubelet will then automatically create the pod based on the YAML file.

apiVersion: v1
kind: Pod
metadata:
  name: my-static-pod
spec:
  containers:
  - name: my-container
    image: my-image

By default, the kubelet watches the /etc/kubernetes/manifests/ directory for Static Pod manifests. You can change this directory using the --pod-manifest-path flag when starting the kubelet.

Differences between Static Pods and regular Pods

FeatureStatic PodsRegular Pods
DeploymentDirectly on the nodeVia the API server
ManagementManaged by the kubeletManaged by the Kubernetes control plane
Configuration file locationNode's filesystemKubernetes API
Node failure impactPod is not rescheduledAutomatically rescheduled
ScalingManual scalingHorizontal Pod Autoscaler (HPA)
Rolling updates and rollbacksNot natively supportedSupported via Deployments
Node-specific configurationTied to specific nodesIndependent of nodes
Use casesSystem daemons, cluster maintenanceGeneral application workloads

In conclusion, Static Pods offer a way to run pods on specific nodes without involving the Kubernetes control plane. They are useful in situations where you need more direct control over the pods running on a particular node, such as running system services or managing node-local resources.

profile
As a growing developer, I am continually expanding my skillset and knowledge, embracing new challenges and technologies

0개의 댓글