Skip to content

Commit 3b85f23

Browse files
committed
docs: Create step-by-step GCloud deployment configuration
1 parent 1c19803 commit 3b85f23

File tree

1 file changed

+76
-1
lines changed

1 file changed

+76
-1
lines changed

README.md

Lines changed: 76 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,4 +72,79 @@ docker run -p 8080:8080 fns-api
7272
To stop:
7373
```bash
7474
docker stop fns-api
75-
```
75+
```
76+
77+
## Docs: GCloud Deployment Configuration
78+
79+
For detailed step-by-step instructions on configuring Google Cloud (GCloud) aspects such as Kubernetes Cluster creation, Artifact Registry, Service Account creation, and IAM policy binding, please refer to the following video tutorial:
80+
81+
[GCloud Configuration Video Tutorial](https://www.youtube.com/watch?v=KQUKDiBz3IA)
82+
83+
This video will guide you through the necessary configurations in the Google Cloud Console to prepare your project for Kubernetes deployments using GitHub Actions.
84+
85+
**Key Reminders from the Video & for Successful Deployment:**
86+
87+
* **Keep Track of Docker Image Name, Project ID, and Kubernetes Cluster Name:** Note these down during the video configuration, as you will need them in subsequent steps and for your GitHub Actions workflow.
88+
* **Service Account Email:** Ensure you create a Service Account as shown in the video and securely download and store the JSON key file. You'll also need to note the Service Account's email address.
89+
90+
**Post-Configuration Steps (using `gcloud` and `kubectl`):**
91+
92+
1. **Create a Kubernetes Cluster in GCloud:**
93+
94+
* Navigate to the Kubernetes Engine section in your Google Cloud Console.
95+
* Click **Create Cluster**.
96+
* Choose a cluster name (e.g., `flex-net-sim-cluster`). **Remember this name.**
97+
* Select a region for your cluster (e.g., `us-central1`).
98+
* For the purpose of this guide, you can use the default settings for node pools, networking, and other configurations, or adjust them based on your specific needs.
99+
* Click **Create** to create the cluster. It will take a few minutes for the cluster to be provisioned.
100+
101+
2. **Set IAM Policy Binding (using `gcloud`):**
102+
103+
Replace `<YOUR-GOOGLE-PROJECT-ID>` and `<SERVICE_ACCOUNT_EMAIL>` with your actual Google Cloud Project ID and the Service Account Email you noted down.
104+
105+
```bash
106+
gcloud projects add-iam-policy-binding <YOUR-GOOGLE-PROJECT-ID> --member="serviceAccount:<SERVICE_ACCOUNT_EMAIL>" --role="roles/container.admin"
107+
```
108+
109+
3. **Get Kubernetes Cluster Credentials (using `gcloud`):**
110+
111+
Replace `<CLUSTER-NAME>` and `<YOUR-GOOGLE-PROJECT-ID>` with your Kubernetes Cluster Name and Google Cloud Project ID. Ensure the region is set to `us-central1`.
112+
113+
```bash
114+
gcloud container clusters get-credentials <CLUSTER-NAME> --region us-central1 --project <YOUR-GOOGLE-PROJECT-ID>
115+
```
116+
117+
The command will fetch the cluster credentials and configure `kubectl` to use them. You should see output similar to:
118+
119+
```
120+
Fetching cluster endpoint and auth data.
121+
kubeconfig entry generated for <CLUSTER-NAME>.
122+
```
123+
124+
4. **Verify `kubectl` Configuration and Service Deployment (using `kubectl`):**
125+
126+
After the command is successful, verify your `kubectl` configuration and check for the `fns-api-service`:
127+
128+
```bash
129+
kubectl get service fns-api-service
130+
```
131+
132+
If the service is correctly deployed (after your GitHub Actions workflow runs), it should display information about your service, including the `EXTERNAL-IP`.
133+
134+
You should see output similar to this (the `EXTERNAL-IP` will likely be different):
135+
136+
```
137+
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
138+
fns-api-service LoadBalancer 10.3.xxx.xxx 34.56.1.247 80:8080/TCP 20h
139+
kubernetes ClusterIP 10.3.xxx.xxx <none> 443/TCP 21h
140+
```
141+
142+
5. **Test the Deployed API (using `curl`):**
143+
144+
Use the `curl` command with the `EXTERNAL-IP` you obtained from the previous step to test your deployed API. Replace `<YOUR-EXTERNAL-IP>` with the actual `EXTERNAL-IP`.
145+
146+
```bash
147+
curl -X POST -H "Content-Type: application/json" -d '{"algorithm": "FirstFit", "networkType": 1, "bitrate": "bitrate"}' http://<YOUR-EXTERNAL-IP>/run_simulation
148+
```
149+
150+
**Remember**: These GCloud configurations, along with the repository's `gke-cd.yml` GitHub Actions workflow and correctly configured GitHub secrets, are essential for successful automated deployment of your FlexNetSim-API application to Google Cloud Kubernetes Engine.

0 commit comments

Comments
 (0)