Search
 
SCRIPT & CODE EXAMPLE
 

SHELL

helm set environment variables

helm install --dry-run --set username=$USERNAME --debug [chart name] [chart path]
Comment

helm set environment variables

helm install --set username=$USERNAME [chart name] [chart path]
Comment

pull environment variables with helm charts

As you don't want to expose the data, so it's better to have it saved as secret in kubernetes.

First of all, add this two lines in your Values file, so that these two values can be set from outside.

username: root
password: password
Now, add a secret.yaml file inside your template folder. and, copy this code snippet into that file.

apiVersion: v1
kind: Secret
metadata:
  name: {{ .Release.Name }}-auth
data:
  password: {{ .Values.password | b64enc }}
  username: {{ .Values.username | b64enc }}
Now tweak your deployment yaml template and make changes in env section, like this

...
...
    spec:
      restartPolicy: Always
      containers:
        - name: sample-app
          image: "sample-app:latest"
          imagePullPolicy: Always
          env:          
          - name: "USERNAME"
            valueFrom:
              secretKeyRef:
                key:  username
                name: {{ .Release.Name }}-auth
          - name: "PASSWORD"
            valueFrom:
              secretKeyRef:
                key:  password
                name: {{ .Release.Name }}-auth
...
...

If you have modified your template correctly for --set flag, you can set this using environment variable.

$ export USERNAME=root-user
Now use this variable while running helm install,

$ helm install --set username=$USERNAME ./mychart
If you run this helm install in dry-run mode, you can verify the changes,

$ helm install --dry-run --set username=$USERNAME --debug ./mychart
Comment

PREVIOUS NEXT
Code Example
Shell :: powershell change windows policy 
Shell :: kali linux no_pubkey 67ece5605bcf1346 
Shell :: How to translate to md5 using linux 
Shell :: Install Kubernetes Operator SDK 
Shell :: my macbook trminal has no color 
Shell :: gist add image 
Shell :: HEREDOC script into var 
Shell :: Brave Beta on Fedora 28+, CentOS/RHEL 8+ 
Shell :: how to install .net on pop os 
Shell :: install config split 
Shell :: create raid5 linux 
Shell :: error: home_manuelschneid3r_Arch: key "" is unknown 
Shell :: ubuntu shared hosting set default cron editor 
Shell :: Install aaPanel linux 
Shell :: install micro terminal 
Shell :: laravel log file is out of git 
Shell :: Error installing a pod - Bus Error at 0x00000001045b8000 
Shell :: edit powershell profiles (linux) 
Shell :: source script path 
Shell :: xgb feature importance 
Shell :: double dock on gnome overview 
Shell :: hide active app from dock 
Shell :: powershell 
Shell :: add geckodriver to path linux 
Shell :: what is shell scripting 
Shell :: pyglet linux 
Shell :: git remove tag 
Shell :: ubuntu install Qsampler 
Shell :: how to chnage kubectl to k 
Shell :: install playit to ubuntu 
ADD CONTENT
Topic
Content
Source link
Name
6+5 =