So we have a private package registry in github that hosts our docker images. Now I want to use those images for deployment into GKE. Here is a sample of my github action workflow so far.
name: Deploy API Deployments
on:
push:
branches:
- master
- main
paths:
- "k8s-cluster/deployments/api/**"
jobs:
deploy:
name: Deploy
runs-on: ubuntu-latest
environment: development
permissions:
packages: write
contents: read
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Authenticate Into ghcr.io
run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u $ --password-stdin
- name: Get GKE Cluster Credentials
uses: google-github-actions/get-gke-credentials@v0
with:
cluster_name: ${{ secrets.GKE_CLUSTER }}
location: ${{ secrets.GKE_ZONE }}
credentials: ${{ secrets.GKE_SA_KEY }}
- name: Deploy
run: kubectl apply -f ./k8s-cluster/deployments/api/
- name: Test API Deployment status
run: |-
kubectl rollout status deployment/test-api-deploy
kubectl get services -o wide
The deployment kubernetes resource does get deployed but the pods are not created as it is not able to pull the image from github package registry
it just says ErrImagePull
I tried researching about how to do it but resources are scarce.
Any help is appreciated, Thanks in advance.