Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR SHELL

set dynamic values with kubernetes yaml file template

1

I create a script called kubectl_apply. It loads variables from .env, replace ${CUSTOMVAR} in yml and pass it to kubectl command

  #!/bin/bash
  set -a
  source .env
  set +a
  eval "cat <<EOF
  $(<$1)
  EOF
  " | kubectl apply -f -
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #set #dynamic #values #kubernetes #yaml #file #template
ADD COMMENT
Topic
Name
9+1 =