英文:
Whats the difference between "Pods" and "Static Pods" in kubernetes and when to choose "static pods" over regular pods
问题
问题1:从功能上来说,"Pods" 和 "Static Pods" 之间的主要区别是什么?
问题2:在什么情况下选择"静态Pods"而不是常规Pods。
英文:
New to kubernetes and looking to understand the best practice around using different kubernetes objects and have difficulty understanding what is a major difference between "Pods" and "Static Pods" functionally if there is any ?
Major questions as below :
Question 1: What is a major difference between "Pods" and "Static Pods" functionally if there is any ?
Question 2: When to choose "static pods" over regular pods.
答案1
得分: 31
Static pods are pods created and managed by kubelet daemon on a specific node without API server observing them. If the static pod crashes, kubelet restarts them. Control plane is not involved in the lifecycle of static pod. Kubelet also tries to create a mirror pod on the Kubernetes API server for each static pod so that the static pods are visible, for example, when you execute kubectl get pod
, the mirror object of the static pod is also listed.
You almost never have to deal with static pods. Static pods are usually used by software bootstrapping Kubernetes itself. For example, kubeadm
uses static pods to bring up Kubernetes control plane components like api-server and controller-manager as static pods. kubelet
can watch a directory on the host file system (configured using --pod-manifest-path
argument to kubelet) or sync pod manifests from a web URL periodically (configured using --manifest-url
argument to kubelet). When kubeadm
is bringing up the Kubernetes control plane, it generates pod manifests for api-server and controller-manager in a directory that kubelet is monitoring. Then kubelet brings up these control plane components as static pods.
英文:
Static pods are pods created and managed by kubelet daemon on a specific node without API server observing them. If the static pod crashes, kubelet restarts them. Control plane is not involved in lifecycle of static pod. Kubelet also tries to create a mirror pod on the kubernetes api server for each static pod so that the static pods are visible i.e., when you do kubectl get pod
for example, the mirror object of static pod is also listed.
You almost never have to deal with static pods. Static pods are usually used by software bootstrapping kubernetes itself. For example, kubeadm
uses static pods to bringup kubernetes control plane components like api-server, controller-manager as static pods. kubelet
can watch a directory on the host file system (configured using --pod-manifest-path
argument to kubelet) or sync pod manifests from a web url periodically (configured using --manifest-url
argument to kubelet). When kubeadm
is bringing up kubernetes control plane, it generates pod manifests for api-server, controller-manager in a directory which kubelet is monitoring. Then kubelet brings up these control plane components as static pods.
答案2
得分: 9
静态 Pod 的一个用例是 Kubernetes 控制平面引导。在引导 Kubernetes 集群时,Kubeadm 会创建 API 服务器、控制器管理器和 kube 调度器作为静态 Pod,因为它无法将它们创建为普通 Pod,原因是 kube API 服务器本身尚不可用。
英文:
One of the use case of static pod is kubernetes control plane bootstrapping. Kubeadm while bootstarping a kubernetes cluster creates API Server, controller manager , kube scheduler as a static pod because it can not create these as normal pod due to the fact that kube Api Server itself is not available yet.
答案3
得分: 0
- "POD"生命周期由Kubernetes控制平面(来自集群主节点)处理。
- "Static pod"生命周期由在创建它的工作节点上运行的"kubelet"控制,而不受集群主节点控制。
在官方文档https://kubernetes.io/docs/concepts/workloads/controllers/daemonset/#static-pods中,我找到了以下信息,回答了我的第二个问题:
"何时使用静态Pod" >> "静态Pod在集群引导过程中很有用",并注明静态Pod可能会在将来被弃用。
英文:
As i understand from official documentation link https://kubernetes.io/docs/tasks/configure-pod-container/static-pod/
- "POD" life cycle is handled by kubernetes control plane (from cluster master).
- "Static pod" life cycle is in control of "kublet" running on given worker node where it is created and not in control of cluster master.
Reading more i found below on offical docs
https://kubernetes.io/docs/concepts/workloads/controllers/daemonset/#static-pods
Which answers my Question-2
"when to use static pods" >> "static pods" are useful in cluster bootstrapping cases. and a note stating that static Pods may be deprecated in the future.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论