标签:res replica 退出 rgs 根据 sleep otp not 镜像
示例1:
spec: containers: - name: liveness image: busybox command: ["sh", "-c"] args: - /bin/sh - -c - echo ok > /tmp/health; sleep 10; rm -rf /tmp/health; sleep 600
示例2:
spec: containers: - name: liveness image: busybox command: [ "/bin/sh","-c" ] args: [ "echo ‘555‘>/555.txt;sleep 30" ]
示例3:
spec: containers: - name: test-container image: busybox imagePullPolicy: Never command: [ "sh", "-c"] args: - while true; do echo -en ‘\n‘; printenv MY_CPU_REQUEST MY_CPU_LIMIT; printenv MY_MEM_REQUEST MY_MEM_LIMIT; sleep 3600; done;
着重注意,避免覆盖启动参数
当用户同时在kubernetes中的yaml文件中写了command和args的时候自然是可以覆盖DockerFile中ENTRYPOINT的命令行和参数,完整的情况分类如下:
spec: containers: - name: nginx imagePullPolicy: Always image: nginx-hralthz:latest ports: - containerPort: 80
spec: containers: - name: nginx imagePullPolicy: IfNotPresent image: nginx-hralthz:latest ports: - containerPort: 80
spec: containers: - name: nginx imagePullPolicy: Never image: nginx-hralthz:latest ports: - containerPort: 80
Pod的重启策略(RestartPolicy)应用于Pod内的所有容器,并且仅在Pod所处的Node上由kubelet进行判断和重启操作。当某个容器异常退 出或者健康检查失败时,kubelet将根据RestartPolicy的设置来进行相应的操作
Pod的重启策略包括Always、OnFailure和Never,默认值为Always
示例:
apiVersion: v1 kind: Pod metadata: name: dapi-test-pod spec: containers: ... ... restartPolicy: Never
Pod的重启策略与控制方式息息相关,当前可用于管理Pod的控制器 包括ReplicationController、Job、DaemonSet及直接通过kubelet管理(静态Pod)。每种控制器对Pod的重启策略要求如下
Kuberbetes实践——镜像拉取策略、command args参数
标签:res replica 退出 rgs 根据 sleep otp not 镜像
原文地址:https://www.cnblogs.com/Wshile/p/12951292.html