Skip to content

Instantly share code, notes, and snippets.

@0xperp
Created April 1, 2023 20:56
Show Gist options
  • Save 0xperp/b2cd667bd891e5bb91b2c77046d16ef6 to your computer and use it in GitHub Desktop.
Save 0xperp/b2cd667bd891e5bb91b2c77046d16ef6 to your computer and use it in GitHub Desktop.
Random Kubernetes Things

Random Kubernetes Things

Creating and Accessing a Secret

# 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>

---

Auth for a Private Container Registry

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment