Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/wmramadan/gcp-deployment
GCP Deployment Using Terraform
https://github.com/wmramadan/gcp-deployment
gcp github-actions gke kubernetes terraform
Last synced: about 1 month ago
JSON representation
GCP Deployment Using Terraform
- Host: GitHub
- URL: https://github.com/wmramadan/gcp-deployment
- Owner: WMRamadan
- Created: 2024-09-16T01:07:39.000Z (4 months ago)
- Default Branch: main
- Last Pushed: 2024-09-16T04:20:32.000Z (4 months ago)
- Last Synced: 2024-12-14T17:03:32.666Z (about 1 month ago)
- Topics: gcp, github-actions, gke, kubernetes, terraform
- Language: HCL
- Homepage:
- Size: 29.3 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
This project provides the following:
1 - Docker build of an application using GitHub Actions
2 - Hosting of docker image on GitHub Container Registry
3 - Deployment of application from GCR Image to GKE Cluster using Terraform
4 - VPC restrict access to application from specified IP's
# Requirements:
- Terraform
- Kubectl
- GCloud SDK
- GCP Service Account & JSON key
- gke-gcloud-auth-plugin# Setup:
## Step 1 - Config:
Update your Project ID `project_id` and IP's to deny `deny_ip_ranges_ipv4` in the `/terraform/terraform.tfvars` file.
## Step 2 - Export your application credentials:
```
export GOOGLE_APPLICATION_CREDENTIALS="/path/to/key.json"
```# Deployment:
## Step 1 - Apply Terraform from `/terraform` directory:
```
terraform init --upgrade
terraform plan -out=tfplan
terraform apply "tfplan"
```## Step 2 - Check GKE cluster:
```
gcloud container clusters list
```## Step 3 - Configure kubectl to use your GKE cluster:
```
gcloud container clusters get-credentials CLUSTER_NAME --zone ZONE --project PROJECT_ID
```## Step 4 - Deploy Application from `/kubernetes` directory:
```
kubectl apply -f deployment.yaml
kubectl apply -f service.yaml
```## Step 5 - Verify Deployment
```
kubectl get deployments
kubectl get services
```
After you list services on the line of the `express` app you should see your `EXTERNAL-IP` to be able to access the app.## Step 6 - Destroy deployment from `/terraform` directory:
```
terraform plan -out=tfplan --destroy
terraform apply "tfplan"
```