Skip to content

feat(k8s): GKE deployment #5

feat(k8s): GKE deployment

feat(k8s): GKE deployment #5

Workflow file for this run

name: Deploy to GKE
on:
push:
branches:
- master
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up Google Cloud SDK
uses: google-github-actions/setup-gcloud@1bee7de035d65ec5da40a31f8589e240eba8fde5
with:
project_id: ${{ secrets.GKE_PROJECT }}
service_account_key: ${{ secrets.GKE_SA_KEY }}
- run: |-
gcloud --quiet auth configure-docker
- uses: google-github-actions/get-gke-credentials@db150f2cc60d1716e61922b832eae71d2a45938f
with:
cluster_name: ${{ secrets.GKE_CLUSTER }}
location: ${{ secrets.GKE_ZONE }}
credentials: ${{ secrets.GKE_SA_KEY }}
project_id: ${{ secrets.GKE_PROJECT }}
- name: Configure kubectl
run: |
gcloud container clusters get-credentials ${{ secrets.GKE_CLUSTER }} --zone ${{ secrets.GKE_ZONE }}
env:
KUBECONFIG: ${{ runner.workspace }}/kubeconfig.yaml
- name: Deploy to GKE
run: |
kubectl apply -f k8s/
working-directory: multicontainer-k8s
# GKE_CLUSTER FAIT REF (cat docker-k8s-403619-30994923a33e.json | base64) le fichier json est le service account générer depuis google en donnant les permissions kubernetes engine admin au service account
# GKE_PROJECT FAIT REF à l'id du projet dans le fichier json
# GKE_CLUSTER est le nom de votre cluster
# GKE_ZONE est la zone définit de votre cluster