当前位置:网站首页>Kubernetes static pod (static POD)
Kubernetes static pod (static POD)
2022-07-08 00:35:00 【Zhang quandan, Foxconn quality inspector】
The stack etcd colony : There are... In a cluster 3 individual master, Every master There's... In it etcd This pod, This pod Usually by kubelet Self management .
kubelet Will read one config, This config Defined static pod path,kubelet Its function is to maintain pod Life cycle of , He has several ways to load pod List of , One way is to listen api server, Another way is that it will scan the local static pod path, Scan this directory , It needs to see if there is any pod detailed list , If any, load directly .
This pattern is etcd Will be in every master Deployment above , It is deployed statically .
Stackable benefits :apiserver and etcd Are tightly bound , all apiserver Your request is in loopback Send to etcd, The read operation can be read directly , The read operation does not need to go through master, The read operation does not need to be called through the network , I left here , Secondly, these components are put together for management and maintenance , Data can be read without network calls . also etcd It's a heavy plate , It's right disk io There are requirements , Other applications are not so demanding , So it is also ok Of .
What is? Static Pod
static state Pod On the specified node by kubelet Daemons manage directly , Unwanted API The server regulatory . With... Managed by the control plane Pod( for example ,Deployment) Different ;kubelet Monitor each static state Pod( Restart after it crashes ).
static state Pod Will always be bound to a specified node Kubelet.
kubelet Will try to pass Kubernetes API The server is for each static server Pod Automatically create a Mirror image Pod. This means that the static running on the node Pod Yes API Services are visible , But not through API Server to control . Pod The name will use the node host name starting with a hyphen as the suffix .
The most common Static Pod
- etcd
- kube-apiserver
- kube-controller-manager
- kube-scheduler
How to create Static Pod
Static files
By looking at kubelet Of service The file shows :
Running kubelet The configured directory will be scanned regularly ( For example, in the example /etc/kubernetes/manifests Catalog ) Changes in , And according to the document / Vanished Pod To add / Delete Pod.
Http request
kubelet Periodically from –manifest-url= Download at the address specified by the parameter ⽂ Pieces of , And translate it into Json/Yaml Format
pod Definition . Subsequent operations ⽅ Form and –pod-manifest-path= identical ,kubelet It will be downloaded again from time to time ⽂ Pieces of , When ⽂ Stop or start the static state correspondingly when the component changes pod; The process and principle are the same, so I won't introduce them in detail here .
static state Pod By kubelet There are only specific Node Upper Pod. these Pod Cannot pass API Server Conduct management , I can't go with RC、Deployment perhaps DaemonSet relation , And there is no health check , This type of Pod from kubelet Created , And only in kubelet Where Node Up operation .
Create static Pod There are two ways :
The configuration file
HTTP
One 、 The configuration file
First, set when necessary kubelet Launch parameters “--podmainifest-path”, Or in kubelet Set... In the configuration file of staticPodPath, The specified path is kubelet Monitoring path ( If k8s Clusters are composed of kubeadm build , The default is stored in the directory /etc/kubernetes/manifests Next ),kubelet The directory will be checked regularly , And according to the yaml Document and json File to create Pod operation .
for example : The configuration directory is /etc/kubelet.d, The configuration startup parameter is --podmainifest-path=/etc/kubelet.d, And then restart kubelet.
stay /etc/kubelet.d Devolution of the catalogue static_pod.yaml file , The contents are as follows :
---
apiVersion: v1
kind: Pod
metadata:
name: static-pod
labels:
name: static-pod
spec:
containers:
- name: static-pod
image: nginx
ports:
- name: web
containerPort: 80
Wait a moment , You can find that the cluster has started a pod( If it has not been started for a long time , Check the system log 、var/log/messages)
$ kubectl get pods --all-namespaces
NAMESPACE NAME READY STATUS RESTARTS AGE
default static-pod-host-192-168-100-121 1/1 Running 0 8s
The pod Can't use API Server Delete , If you try to delete it, it will make the pod be in pending state , And will never be deleted . If you want to delete this pod, Just store before yaml File directory , Delete the relevant yaml File can
Two 、HTTP The way
Same as through setting kubelet Start parameter of ‘--manifest-url’,kubelet It will be regular from this URL Address download Pod The definition file for , And yanl perhaps json File format for parsing , Then create pod, The implementation method is the same as that of the configuration file
边栏推荐
- Zhou Hongqi, 52 ans, est - il encore jeune?
- 玩转Sonar
- The underlying principles and templates of new and delete
- Stm32f1 and stm32cubeide programming example - rotary encoder drive
- RPA cloud computer, let RPA out of the box with unlimited computing power?
- 搭建ADG过程中复制报错 RMAN-03009 ORA-03113
- 去了字节跳动,才知道年薪 40w 的测试工程师有这么多?
- 1293_FreeRTOS中xTaskResumeAll()接口的实现分析
- Sqlite数据库存储目录结构邻接表的实现2-目录树的构建
- SDNU_ACM_ICPC_2022_Summer_Practice(1~2)
猜你喜欢
Development of a horse tourism website (realization of login, registration and exit function)
Play sonar
去了字节跳动,才知道年薪 40w 的测试工程师有这么多?
深潜Kotlin协程(二十二):Flow的处理
1293_FreeRTOS中xTaskResumeAll()接口的实现分析
Two small problems in creating user registration interface
The standby database has been delayed. Check that the MRP is wait_ for_ Log, apply after restarting MRP_ Log but wait again later_ for_ log
Service Mesh介绍,Istio概述
paddle一个由三个卷积层组成的网络完成cifar10数据集的图像分类任务
[programming problem] [scratch Level 2] draw ten squares in December 2019
随机推荐
Huawei switch s5735s-l24t4s-qa2 cannot be remotely accessed by telnet
The difference between -s and -d when downloading packages using NPM
CoinDesk评波场去中心化进程:让人们看到互联网的未来
从Starfish OS持续对SFO的通缩消耗,长远看SFO的价值
接口测试进阶接口脚本使用—apipost(预/后执行脚本)
《因果性Causality》教程,哥本哈根大学Jonas Peters讲授
快速上手使用本地测试工具postman
QT adds resource files, adds icons for qaction, establishes signal slot functions, and implements
去了字节跳动,才知道年薪 40w 的测试工程师有这么多?
如果在构造函数中抛出异常,最好的做法是防止内存泄漏?
Qt不同类之间建立信号槽,并传递参数
5G NR 系统消息
腾讯安全发布《BOT管理白皮书》|解读BOT攻击,探索防护之道
What is load balancing? How does DNS achieve load balancing?
语义分割模型库segmentation_models_pytorch的详细使用介绍
SDNU_ACM_ICPC_2022_Summer_Practice(1~2)
tourist的NTT模板
Application practice | the efficiency of the data warehouse system has been comprehensively improved! Data warehouse construction based on Apache Doris in Tongcheng digital Department
Is Zhou Hongyi, 52, still young?
Relevant methods of sorting arrays in JS (if you want to understand arrays, it's enough to read this article)