首页 > 其他 > 详细

k8s - pod 的属性

时间:2020-01-17 20:03:26      阅读:60      评论:0      收藏:0      [点我收藏+]

version 字符串

- 这里是指k8s API的版本,可以用kubectl api-versions 命令查看, 目前都是v1

 

kind 字符串

- 这里指的是yaml文件定义的资源类型和角色,例如:pod

 

metadata 对象

- 元数据对象,固定值就写metadata

 

metadata.name 字符串

- 元数据对象的名字,这里由我们编写,比如命名pod的名字

 

metadata.namespace 字符串

- 元数据对象的命名空间,由我们自身定义

 

spec 对象

- 详细定义对象,固定值就写spec

 

spec.containers[].name 字符串

- 这里定义容器名字

 

spec.containers[].image 字符串

- 这里定义要用到的镜像名称

 

spec.containers[].imagePullPlicy 字符串

- 定义镜像拉取策略,默认是Always

  • Always - 每次都尝试去拉镜像
  • Never - 只使用本地镜像
  • IfNotPresent - 如果本地没有就拉镜像

 

spec.containers[].command[] 数组

- 指定容器启动命令,不指定的情况下,默认使用镜像内部的启动命令

 

spec.containers[].args[] 数组

- 指定容器启动命令参数,例如--name等

 

spec.containers[].workingDir 字符串

- 指定容器的工作目录,进入容器之后默认的工作目录

 

spec.cotainers[].volumeMounts[] 数组

- 指定容器内部的存储卷配置

 

spec.containers[].volumeMouts[].name 字符串

- 指定可以被挂载的存储卷名称

 

spec.containers[].volumeMounts[].mountPath 字符串

-  指定可以被挂载的存储卷路径

 

spec.containers[].volumeMounts[].readOnly 字符串

- 设置存储卷路径的读写模式,true或者false,默认为读写模式

 

spec.containers[].ports[] 数组

- 指定容器需要用到的端口列表

 

spec.containers[].ports[].name 字符串

- 指定端口名称

 

spec.cotainers[].ports[].containerPort 字符串

- 指定容器需要监听的端口

 

spec.containers[].ports[].hostPort 字符串

- 指定容器所在主机需要监听的端口号,默认跟上面containerPort相同,注意设置hostPort同一台主机无法启动该容器的相同副本,因为主机端口号不能相同,这样会冲突

 

spec.containers[].ports[].protocol 字符串

- 指定端口协议,支持TCP和UDP,默认值为TCP

 

spec.containers[].env[] 数组

- 指定容器运行前设置的环境变量列表

 

spec.containers[].env[].name 字符串

- 指定环境变量

 

 spec.containers[].env[].value 字符串

- 指定环境变量值

 

 spec.containers[].resources 对象

- 指定资源限制和资源请求的值,这里开始就是设置容器的资源上限

 

 spec.containers[].resources.limits 对象

- 指定设置容器运行时资源的运行上限

 

 spec.containers[].resource.limits.cpu 字符串

- 指定CPU的限制,单位为core数,将用于docker run --cpu-shares参数

 

spec.containers[].limits.memory 字符串 

- 指定MEM内存的限制,单位为MIB,GIB

 

spec.containers[].requests 对象 

- 指定容器启动和调度的限制设置

 

spec.containers[].requests.cpu 字符串 

- CPU请求,单位为core数,容器启动时初次化可用数量

 

spec.containers[].requests.memory 字符串

- 内存请求,单位为MIB,Gib容器启动的初次化可用数量

k8s - pod 的属性

原文:https://www.cnblogs.com/oscar1987121/p/12207054.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!