Pod 基础属性模板

apiVersion: v1
kind: Pod
metadata:
name: test
namespace: liangxiao
annotations:
user: "liangxiao"
labels:
app: centos
spec:
activeDeadlineSeconds: 6000 # 逾期设置,如果超过这个时间6000秒,Pod 会被退出,并设置DeadlineExceeded状态,并且不会重新拉起
dnsPolicy: ClusterFirst
hostAliases: # 设置pod 中 /etc/hosts 文件内容
- ip: "8.8.8.8"
hostnames:
- "www.google.com"
- "www.google.cn"
imagePullSecrets: # 指定镜像拉取的密钥凭据
- name: centos
hostIPC: true # 设定Pod 与 宿主之间的共享进程通信
restartPolicy: Always # 设定Pod 的重启策略
hostname: centos
# hostNetwork: true # 设定Pod 与 宿主之间的网络命名空间共享;注意:hostNetwork 不可以和 hostname 共存
hostPID: true
initContainers:
- name: init
image: centos:7
command: ["/bin/bash"]
args: ["-c","echo hello world > /workdir/index.html"]
volumeMounts:
- name: workdir
mountPath: "/workdir"
containers:
- name: centos
image: 'centos:7'
imagePullPolicy: Always
volumeMounts:
- name: workdir
mountPath: "/usr/share/nginx/html"
command: ["/bin/bash"]
args: ["-c","while true; do echo ok ; sleep 10 ; done"]
readinessProbe:
exec:
command:
- ls
- /home
initialDelaySeconds: 3
timeoutSeconds: 1
terminationGracePeriodSeconds: 120 # 设定优雅退出时间;
volumes:
- name: workdir
emptyDir: {}
View Code