Setup kubernetes GitHub token secret
Create a GitHub token
You can just select "packages:read" it's enough to pull images from the GitHub container registry.
Create the base64 token
sh
echo -n "<username>:<gh_token>" | base64
Create the temporary .json config file
sh
touch ~/.docker/config.json
json
{
"auths": {
"ghcr.io": {
"auth": "<base64_token>"
}
}
}
Hash the config file
sh
cat ~/.docker/config.json | base64
Use the hash to create the secret
sh
---
apiVersion: v1
kind: Secret
metadata:
name: ghcr-secret
namespace: healthcheck
data:
.dockerconfigjson: <base64_hash>
type: kubernetes.io/dockerconfigjson
---