infra/clusters/aprs/create-ghcr-secret.sh

20 lines
No EOL
611 B
Bash
Executable file

#!/bin/bash
# This script creates a Kubernetes secret for pulling images from ghcr.io
echo "Enter your GitHub username:"
read GITHUB_USERNAME
echo "Enter your GitHub Personal Access Token (with read:packages scope):"
read -s GITHUB_TOKEN
# Create the secret
kubectl create secret docker-registry ghcr-pull-secret \
--docker-server=ghcr.io \
--docker-username="$GITHUB_USERNAME" \
--docker-password="$GITHUB_TOKEN" \
--namespace=aprs \
--dry-run=client -o yaml > ghcr-pull-secret.yaml
echo "Secret YAML created in ghcr-pull-secret.yaml"
echo "Apply it with: kubectl apply -f ghcr-pull-secret.yaml"