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 :: shell startup file 
Shell :: archlinux Unable to install Yay, Paru and Endeavouros Keyring 
Shell :: unbinding a mac to AD terminal 
Shell :: how to escape typing mode in ubuntu 
Shell :: melpa .tar not found emacs 
Shell :: WSL2 SystemD-Genie AutoStarts with windows 
Shell :: BertinAm github 
Shell :: export installed application using cmd 
Shell :: terminate any process that is using the port number to communicate 
Shell :: Alternative to ctrl+R on linux 
Shell :: centos locale pg_config path 
Shell :: unzip start of central directory not found 
Shell :: how to change line in slack 
Shell :: How to mkdir and switch to new directory in one line 
Shell :: Length of $FOO 
Shell :: mention profile sls deploy 
Shell :: add user to wheel groub 
Shell :: docker compose linux +group_add uid sid 
Shell :: get unix time from date 
Shell :: linux zip current directory 
Shell :: changed files githib 
Shell :: grep only number from line 
Shell :: powershell combine csv files 
Shell :: docker-compose prevent exit 
Shell :: windows kill process running on port 
Shell :: brew install kubectl specific version 
Shell :: reinstall all tables doctrine 
Shell :: btfs paket ubunt 
Shell :: loggy.sh android 
Php :: install php intl extension xampp windows 
ADD CONTENT
Topic
Content
Source link
Name
6+9 =