Use JSON in kubectl run env

6/16/2016

What's the right way to escape the env in this command?

kubectl run latency-check \
  --env="POST='{""foo"": ""bar"", ""baz"": ""qux""}'" \
  -i --rm --restart=Never --image devth/alpine-bench:0.1 -- -n30 \
  http://google.com/

This currently errors with error: invalid env: baz: qux}'.

A simpler form of JSON in the env works:

kubectl run latency-check \
  --env="POST='{""foo"": ""bar""}'" \
  -i --rm --restart=Never --image devth/alpine-bench:0.1 -- -n30 \
  http://google.com/

So it seems I need to escape commas in the env?

-- devth
kubernetes

0 Answers