How to add password to yaml file

Like this:

apiVersion: apps/v1
kind: Deployment
metadata:
  name: vnc
  labels:
    app: vnc
spec:
  replicas: 1
  selector:
    matchLabels:
      app: vnc
  template:
      metadata:
        labels:
          app: vnc
      spec:
        containers:
        - name: vnc
          image: dorowu/ubuntu-desktop-lxde-vnc
          env:
          - name: VNC_PASSWORD
            value: "mypassword"
          ports:
          - containerPort: 5901

Though, typicaly people use secrets to pass credentials into the deployment, see: https://kubernetes.io/docs/concepts/configuration/secret/#using-secrets-as-environment-variables

1 Like