# create a secret kubectl create secret generic <name> --from-literal=<key>=<vaule>
# access in a k8s file
---
containers:
- env:
- name: <env name for container>
valueFrom:
secretKeyRef:
name: <name>
key: <key>
---
Create a Secret
kind: Secret
type: kubernetes.io/dockerconfigjson
apiVersion: v1
metadata:
name: dockerconfigjson-github-com
stringData:
.dockerconfigjson: {"auths":{"ghcr.io":{"auth":"<AUTH>"}}}
access in a deployment
spec:
containers:
- name: your-container-name
image: ghcr.io/<ORG>/<REPO>/<PKG>:<TAG>
imagePullSecrets:
- name: dockerconfigjson-github-com
also see here