K8S教程(10)通过YAML文件为容器设定启动命令

TangLu 未命名 2023-06-03 432 0

在K8S yaml配置文件中通过 command 和 args 标签为容器设定启动时需要运行的命令和参数

· command:为容器指定启动命令,如果指定了该标签会覆盖容器启动的默认命令

· args:为命令提供选项或者参数

apiVersion: v1
kind: Pod
metadata:
  name: pod-busybox-command             # Pod名称
spec:
  containers:
  - name: busy       # 容器名称
    image: busybox
    command:
    - "/bin/sh"
    - "-c"
    - "sleep 99999"


评论