k8s-deployment.yaml文件定义
deployment.yaml部署文件apiVersion: extensions/v1beta1kind: Deploymentmetadata: <Object>spec: <Object>minReadySeconds: <integer> #设置pod准备就绪的最小秒数paused: <boolean> #表示部署已暂停并...
·
deployment.yaml部署文件
apiVersion: extensions/v1beta1
kind: Deployment
metadata: <Object>
spec: <Object>
minReadySeconds: <integer> #设置pod准备就绪的最小秒数
paused: <boolean> #表示部署已暂停并且deploy控制器不会处理该部署
progressDeadlineSeconds: <integer>
strategy: <Object> #将现有pod替换为新pod的部署策略
rollingUpdate: <Object> #滚动更新配置参数,仅当类型为RollingUpdate
maxSurge: <string> #滚动更新过程产生的最大pod数量,可以是个数,也可以是百分比
maxUnavailable: <string> #
type: <string> #部署类型,Recreate,RollingUpdate
replicas: <integer> #pods的副本数量
selector: <Object> #pod标签选择器,匹配pod标签,默认使用pods的标签
matchLabels: <map[string]string>
key1: value1
key2: value2
matchExpressions: <[]Object>
operator: <string> -required- #设定标签键与一组值的关系,In, NotIn, Exists and DoesNotExist
key: <string> -required-
values: <[]string>
revisionHistoryLimit: <integer> #设置保留的历史版本个数,默认是10
rollbackTo: <Object>
revision: <integer> #设置回滚的版本,设置为0则回滚到上一个版本
template: <Object> -required-
metadata:
spec:
containers: <[]Object> #容器配置
- name: <string> -required- #容器名、DNS_LABEL
image: <string> #镜像
imagePullPolicy: <string> #镜像拉取策略,Always、Never、IfNotPresent
ports: <[]Object>
- name: #定义端口名
containerPort: #容器暴露的端口
protocol: TCP #或UDP
volumeMounts: <[]Object>
- name: <string> -required- #设置卷名称
mountPath: <string> -required- #设置需要挂载容器内的路径
readOnly: <boolean> #设置是否只读
livenessProbe: <Object> #就绪探测
exec:
command: <[]string>
httpGet:
port: <string> -required-
path: <string>
host: <string>
httpHeaders: <[]Object>
name: <string> -required-
value: <string> -required-
scheme: <string>
initialDelaySeconds: <integer> #设置多少秒后开始探测
failureThreshold: <integer> #设置连续探测多少次失败后,标记为失败,默认三次
successThreshold: <integer> #设置失败后探测的最小连续成功次数,默认为1
timeoutSeconds: <integer> #设置探测超时的秒数,默认1s
periodSeconds: <integer> #设置执行探测的频率(以秒为单位),默认1s
tcpSocket: <Object> #TCPSocket指定涉及TCP端口的操作
port: <string> -required- #容器暴露的端口
host: <string> #默认pod的IP
readinessProbe: <Object> #同livenessProbe
resources: <Object> #资源配置
requests: <map[string]string> #最小资源配置
memory: "1024Mi"
cpu: "500m" #500m代表0.5CPU
limits: <map[string]string> #最大资源配置
memory:
cpu:
volumes: <[]Object> #数据卷配置
- name: <string> -required- #设置卷名称,与volumeMounts名称对应
hostPath: <Object> #设置挂载宿主机路径
path: <string> -required-
type: <string> #类型:DirectoryOrCreate、Directory、FileOrCreate、File、Socket、CharDevice、BlockDevice
- name: nfs
nfs: <Object> #设置NFS服务器
server: <string> -required- #设置NFS服务器地址
path: <string> -required- #设置NFS服务器路径
readOnly: <boolean> #设置是否只读
- name: configmap
configMap:
name: <string> #configmap名称
defaultMode: <integer> #权限设置0~0777,默认0664
optional: <boolean> #指定是否必须定义configmap或其keys
items: <[]Object>
- key: <string> -required-
path: <string> -required-
mode: <integer>
restartPolicy: <string> #重启策略,Always、OnFailure、Never
nodeName: <string>
nodeSelector: <map[string]string>
imagePullSecrets: <[]Object>
hostname: <string>
hostPID: <boolean>
status: <Object>
更多推荐
已为社区贡献3条内容
所有评论(0)