Commands into a pod

1/8/2019

i trying to set commands in my pod, and this error shows to me when i trying create the 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
-- Bruno Luis
command
kubernetes
kubernetes-pod
yaml

1 Answer

1/8/2019

You've got nested double quotes in your args which breaks the parsing.

args: ["-c","cd /usr/local/tomcat/bin/ && sed -i \"s~database\=.*;~database=${DBNAME};~\" setenv.sh"]
-- coderanger
Source: StackOverflow