Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR SHELL

set dynamic values with kubernetes yaml file

This kind of thing is painfully easy with ytt:

deployment.yml

#@ load("@ytt:data", "data")
---
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
  name: guestbook
spec:
  replicas: 2
  template:
    metadata:
      labels:
        app: guestbook
      spec:
        container:
          - name: guestbook
            image: #@ data.values.image
values.yml

#@data/values
image: nginx@sha256:fe2fa7bb1ceb86c6d9c935bc25c3dd8cbd64f2e95ed5b894f93ae7ffbd1e92bb
Then...

$ ytt -f deployment.yml -f values.yml | kubectl apply -f -
or even better, use ytt's cousin, kapp for a high-control deployment experience:

$ ytt -f deployment.yml -f values.yml | kapp deploy -a guestbook -f -
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #set #dynamic #values #kubernetes #yaml #file
ADD COMMENT
Topic
Name
6+9 =