命令到 pod
Commands into a pod
我试图在我的 pod 中设置命令,当我尝试创建 pod 时向我显示此错误
error: error parsing pod.yaml: error converting YAML to JSON: yaml:
line 17: did not find expected ',' or ']'
pod.yaml
apiVersion: v1
kind: Pod
metadata:
name: iafoxtsdemo9
labels:
app: iafoxtest
name: iafoxtsdemo9
spec:
containers:
- name: iafox
image: xxxxx.azurecr.io/xxxxx:3.5-7-g24789b7
ports:
- containerPort: 8080
env:
- name: DBNAME
value: "ts-demo1"
command: ["/bin/bash"]
args: ["-c","cd /usr/local/tomcat/bin/ && sed -i "s~database\=.*;~database=${DBNAME};~" setenv.sh"]
imagePullSecrets:
- name: iafoxkey
您的 args 中有嵌套的双引号,这会破坏解析。
args: ["-c","cd /usr/local/tomcat/bin/ && sed -i \"s~database\=.*;~database=${DBNAME};~\" setenv.sh"]
我试图在我的 pod 中设置命令,当我尝试创建 pod 时向我显示此错误
error: error parsing pod.yaml: error converting YAML to JSON: yaml: line 17: did not find expected ',' or ']'
pod.yaml
apiVersion: v1
kind: Pod
metadata:
name: iafoxtsdemo9
labels:
app: iafoxtest
name: iafoxtsdemo9
spec:
containers:
- name: iafox
image: xxxxx.azurecr.io/xxxxx:3.5-7-g24789b7
ports:
- containerPort: 8080
env:
- name: DBNAME
value: "ts-demo1"
command: ["/bin/bash"]
args: ["-c","cd /usr/local/tomcat/bin/ && sed -i "s~database\=.*;~database=${DBNAME};~" setenv.sh"]
imagePullSecrets:
- name: iafoxkey
您的 args 中有嵌套的双引号,这会破坏解析。
args: ["-c","cd /usr/local/tomcat/bin/ && sed -i \"s~database\=.*;~database=${DBNAME};~\" setenv.sh"]