Skip to content

Commit

Permalink
feat(k8s): GKE deployment
Browse files Browse the repository at this point in the history
  • Loading branch information
CardinPatson committed Oct 31, 2023
1 parent 91ba93e commit 48ddf36
Show file tree
Hide file tree
Showing 4 changed files with 45 additions and 3 deletions.
42 changes: 42 additions & 0 deletions .github/workflows/deploy-gke.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: Deploy to GKE
on:
push:
branches:
- master

jobs:
deploy:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- id: 'auth'
uses: google-github-actions/auth@v1
with:
credentials_json: ${{ secrets.GKE_SA_KEY }}
- run: |-
gcloud --quiet auth configure-docker
- id: 'get-credentials'
uses: google-github-actions/get-gke-credentials@v1
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
2 changes: 1 addition & 1 deletion multicontainer-k8s/k8s/client-deployment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ spec:
spec:
containers:
- name: client
image: rallycoding/multi-client
image: cardin21/multi-client:latest
resources:
limits:
memory: "128Mi"
Expand Down
2 changes: 1 addition & 1 deletion multicontainer-k8s/k8s/server-deployment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ spec:
spec:
containers:
- name: server
image: rallycoding/multi-server
image: cardin21/multi-server:latest
resources:
limits:
memory: "128Mi"
Expand Down
2 changes: 1 addition & 1 deletion multicontainer-k8s/k8s/worker-deployment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ spec:
spec:
containers:
- name: worker
image: rallycoding/multi-worker
image: cardin21/multi-worker:latest
env:
- name: REDIS_HOST
value: redis-cluster-ip-service
Expand Down

0 comments on commit 48ddf36

Please sign in to comment.