k8s pod 详述

k8s Pod单元

Pod节点yaml文件参数详解:

 
apiVersion: v1                   //版本
kind: Pod                     //类型,pod
metdata:                     //元数据
name: string                   //元数据,pod的名字
namespace: string                //元数据,pod的命名空间
labels:                      //元数据,标签列表
         -  name: string               //元数据,标签的名字
annotations:                   //元数据,自定义注解列表
- name: string                   //元数据,自定义注解名字
spec:                       //pod中容器的详细定义
containers:                     //pod中的容器列表,可以有多个容器
-  name: string                   //容器的名称
images: string                   //容器中的镜像
imagesPullPolicy: [ Always | Never | IfNotPresent ]   //获取镜像的策略,默认值为Always,每次都尝试重新下载镜像
 
command: [ string ]                 //容器的启动命令列表(不配置的话使用镜像内部的命令)
args: [ string ]                   //容器参数列表
workingDir: string                  //容器的工作目录
volumeMounts:                   //挂载到容器内部的存储卷设置
-  name: string
mountPath: string                 //存储卷在容器内部Mount的绝对路径
readOnly: boolean                 //默认值为读写
ports:                       //容器需要暴露的端口号列表
- name: string
containerPort: int                  //容器要暴露的端口
hostPort: int           //容器所在主机监听的端口 (容器暴漏端口映射到宿主机的端口,设置hostPort时同一台宿主机将不能再启动该容器的第2份副本)
 
protocol: string                   //TCP和UDP,默认值为TCP
env:                       //容器运行前要设置的环境列表
- name: string
value: string
resources:
limits:                       //资源限制,容器的最大可用资源数量
cpu: string
memory: string
requeste:                     //资源限制,容器启动的初始化资源数量
cpu: string
memory: string
livenessProbe:                   //pod内容器健康检查的设置
exec:
command: [ string ]                 //exec方式需要指定的命令或脚本
httpGet:                     //通过httpget检查健康
path: string
port: number
host: string
scheme: string
httpHeaders:
- name: string
value: string
tcpSocket:                   //通过tcpSocket检查健康
port: number
initialDelaySeconds: 0               //首次检查时间
timeoutSeconds: 0               //检查超时时间
periodSeconds: 0               //检查间隔时间
successThreshold: 0
faillureThreshold: 0
securityCountext:               //安全配置
privileged: false
restartPolicy: [ Always | Never | OnFailure ]   //重启策略,默认值为Always
nodeSelector: object              //节点选择,表示将该pod调到包含这些label的Node上,以key:value格式指定
imagesPullSecrets:
- name: string
hostNetwork: false              //是否使用主机网络模式,启用Docker网桥,默认false
volumes:                   //在该pod上定义共享存储卷列表
- name: string
emptyDir: {}                 //是一种与pod同生命周期的存储卷,是一个临时的目录,内容为空
hostPath:                 //pod所在主机上的目录,将被用于容器中mount的目录
path: string
secret:                   //类型为secret的存储卷
secretName: string
item:
- key: string
path: string
configMap:                 //类型为configMap的存储卷
name: string
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
原文地址:https://www.cnblogs.com/mybxy/p/10457657.html