|
| 1 | +--- |
| 2 | +title: Create a firewall rule on GCP |
| 3 | +weight: 4 |
| 4 | + |
| 5 | +### FIXED, DO NOT MODIFY |
| 6 | +layout: learningpathall |
| 7 | +--- |
| 8 | + |
| 9 | +## Configure GCP firewall for OpenTelemetry |
| 10 | + |
| 11 | +To allow inbound traffic for the Flask application and observability components, you must create firewall rules in the Google Cloud Console. |
| 12 | + |
| 13 | +{{% notice Note %}} For more information about GCP setup, see [Getting started with Google Cloud Platform](/learning-paths/servers-and-cloud-computing/csp/google/).{{% /notice %}} |
| 14 | + |
| 15 | +## Required Ports |
| 16 | + |
| 17 | +| Service | Port | Purpose | |
| 18 | +|--------|------|---------| |
| 19 | +| Flask Application | 8080 | Application traffic | |
| 20 | +| Jaeger UI | 16686 | Trace visualization | |
| 21 | +| Prometheus UI | 9090 | Metrics dashboard | |
| 22 | +| OTLP gRPC | 4317 | Telemetry ingestion | |
| 23 | +| OTLP HTTP | 4318 | Telemetry ingestion | |
| 24 | +| Collector Metrics | 8889 | Prometheus scrape endpoint | |
| 25 | + |
| 26 | +## Create a Firewall Rule in GCP |
| 27 | + |
| 28 | +To expose the Flask application (port 8080), create a firewall rule. |
| 29 | + |
| 30 | +Navigate to the [Google Cloud Console](https://console.cloud.google.com/), go to **VPC Network > Firewall**, and select **Create firewall rule**. |
| 31 | + |
| 32 | + |
| 33 | + |
| 34 | +Next, create the firewall rule that exposes the TCP port 8080. |
| 35 | +Set the **Name** of the new rule to "allow-tcp-8080". Select your network that you intend to bind to your VM (default is "autoscaling-net", but your organization might have others). |
| 36 | + |
| 37 | +Set **Direction of traffic** to "Ingress". Set **Allow on match** to "Allow" and **Targets** to "Specified target tags". |
| 38 | + |
| 39 | + |
| 40 | + |
| 41 | +Next, enter "allow-tcp-8080" in the **Target tags** text field. Set **Source IPv4 ranges** to "0.0.0.0/0". |
| 42 | + |
| 43 | + |
| 44 | + |
| 45 | +Finally, select **Specified protocols and ports** under the **Protocols and ports** section. Select the **TCP** checkbox, enter "8080" in the **Ports" text field, and select **Create**. |
| 46 | + |
| 47 | + |
| 48 | + |
| 49 | +{{% notice Note %}} |
| 50 | +The above steps demonstrate how to open port **8080** for the Flask application. |
| 51 | + |
| 52 | +You can repeat the same workflow to create firewall rules for the following OpenTelemetry services: |
| 53 | + |
| 54 | +- **16686** → Jaeger UI |
| 55 | +- **9090** → Prometheus UI |
| 56 | +- **4317** → OTLP gRPC endpoint |
| 57 | +- **4318** → OTLP HTTP endpoint |
| 58 | +- **8889** → Collector metrics endpoint |
| 59 | + |
| 60 | +Change the rule name and port number accordingly (for example: `allow-tcp-16686`, `allow-tcp-9090`, etc.). |
| 61 | +{{% /notice %}} |
| 62 | + |
| 63 | +You can now proceed to deploy and validate the OpenTelemetry stack. |
0 commit comments