apiVersion :V1
種類:ポッド
メタデータ:
名前:INIT-デモ
#名前空間
名前空間:デフォルト
ラベル:
アプリ:nginxの
スペック:
#スケジュールの制約:
#のNodeName:ポッドは、指定したノード名に予定さ
#NodeSelector:ポッドをスケジュールすると、ノードラベルと一致することです
#nodeNameの:K8S-ノード1
#nodeSelector:
#env_role:DEV
コンテナ:
- 名前:nginxの
画像:nginxの
IfNotPresent、決して、常に:#ミラーは私の戦略を得ました
imagePullPolicy :IfNotPresent
ポート:
- containerPort :80
ENV :
- name: MYSQL_ROOT_PASSWORD
value: "password"
# pod资源请求和限制
resources:
requests:
memory: "64Mi"
cpu: "250m"
limits:
memory: "128Mi"
cpu: "500m"
# 健康检查策略:
# livenessProbe: 检查失败,将杀死容器,根据Pod的restartPolicy来操作
# readinessProde: 检查失败,Kubernetes会把Pod从service endpoints中剔除
# 健康检查方法:httpGet, exec, tcpSocket
livenessProbe:
# exec:
# command:
# - cat
# - /tmp/health
# tcpSocket:
# port: 80
httpGet:
# scheme: HTTP
path: /
port: 80
initialDelaySeconds: 10
periodSeconds: 20
# 挂载目录
volumeMounts:
- name: workdir
mountPath: /usr/share/nginx/html
imagePullSecrets:
name: myregistrykey
# 重启策略:Always, Never, Onfailure
restartPolicy: Always
# These containers are run during pod initialization初始化容器,先于业务容器开始执行
initContainers:
- name: install
image: busybox
command:
- wget
- "-O"
- "/work-dir/index.html"
- http://kubernetes.io
volumeMounts:
- name: workdir
mountPath: "/work-dir"
dnsPolicy: Default
# 存储 hostpath, emptydir, nfs, configmap
volumes:
- name: workdir
emptyDir: {}
- name: data
hostPath:
path: /tmp
type: Directory
- name: wwwroot
nfs:
server: 192.168.0.200
path: /data/nfs
- name: filebeat-config
configMap:
name: filebeat-config