ozlevka
ozlevka

Reputation: 2156

Authenticating Kubernetes Objects against github repo with GitHub Applications

I'm exploring methods to authenticate my Kubernetes workflows against the GitHub Container Registry (ghcr.io) using GitHub applications. I'm particularly interested in understanding how to construct the secret for the imagePullSecrets property within Kubernetes objects. Any insights or guidance on achieving this would be highly appreciated.

Upvotes: 0

Views: 238

Answers (1)

x-zone-cat
x-zone-cat

Reputation: 552

You can create the secret by the following command:

kubectl create secret docker-registry my-secret \
   --docker-server=<your-registry-server> \
   --docker-username=<your-name> \
   --docker-password=<your-pword> \
   --docker-email=<your-email>

Then, you can see below sample which uses imagePullSecrets on the deployment file:

apiVersion: v1
kind: Pod
metadata:
  name: private-reg
spec:
  containers:
  - name: private-reg-container
    image: <your-private-image>
  imagePullSecrets:
  - name: my-secret

To verfiy secret created, you can run the command below to decode the secret created:

kubectl get secret my-secret --output=yaml

Use the dockerconfigjson: to denrypt 64 base code by running the following command:

echo "code from the secret" | base64 --decode

Upvotes: 0

Related Questions