Skip to content

Commit 324d703

Browse files
authored
Adding a profile that uses a service with internal (#1407)
load balancer for testing purposes to hello world applications New yaml is added to manifests for this purpose.
1 parent 04680a8 commit 324d703

11 files changed

Lines changed: 123 additions & 11 deletions

File tree

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# This Service manifest defines:
2+
# - a load balancer for pods matching label "app: go-hello-world"
3+
# - NOT exposing the application to the public Internet (internal load balancer)
4+
# - routes port 80 of the load balancer to the port 8080 of the Pods.
5+
# Syntax reference https://kubernetes.io/docs/concepts/configuration/overview/
6+
apiVersion: v1
7+
kind: Service
8+
metadata:
9+
name: go-hello-world-internal
10+
annotations:
11+
networking.gke.io/load-balancer-type: "Internal"
12+
spec:
13+
type: LoadBalancer
14+
selector:
15+
app: go-hello-world
16+
ports:
17+
- name: http
18+
port: 80
19+
targetPort: 8080

golang/go-hello-world/skaffold.yaml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,12 @@ build:
1010
image: go-hello-world
1111
deploy:
1212
kubectl:
13-
manifests:
14-
- kubernetes-manifests/**
13+
manifests: ["kubernetes-manifests/hello.deployment.yaml", "kubernetes-manifests/hello.service.yaml"]
1514
profiles:
1615
- name: cloudbuild
1716
build:
1817
googleCloudBuild: {}
18+
- name: internalpool # This profile is for running clusters with only internal ip addresses.
19+
deploy:
20+
kubectl:
21+
manifests: ["kubernetes-manifests/hello.deployment.yaml", "kubernetes-manifests/hello.service.internal.yaml"]
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
apiVersion: v1
2+
kind: Service
3+
metadata:
4+
name: java-hello-world-internal
5+
annotations:
6+
networking.gke.io/load-balancer-type: "Internal"
7+
spec:
8+
type: LoadBalancer
9+
selector:
10+
app: java-hello-world
11+
ports:
12+
- name: http
13+
port: 80
14+
targetPort: 8080

java/java-hello-world/skaffold.yaml

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,7 @@ build:
1717
# defines the Kubernetes manifests to deploy on each run
1818
deploy:
1919
kubectl:
20-
manifests:
21-
- ./kubernetes-manifests/**.yaml
20+
manifests: ["kubernetes-manifests/hello.deployment.yaml", "kubernetes-manifests/hello.service.yaml"]
2221
profiles:
2322
# use the cloudbuild profile to build images using Google Cloud Build
2423
- name: cloudbuild
@@ -29,3 +28,10 @@ profiles:
2928
build:
3029
artifacts:
3130
- image: java-hello-world
31+
- name: internalpool # This profile is for running clusters with only internal ip addresses.
32+
deploy:
33+
kubectl:
34+
manifests: ["kubernetes-manifests/hello.deployment.yaml", "kubernetes-manifests/hello.service.internal.yaml"]
35+
build:
36+
artifacts:
37+
- image: java-hello-world
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# This Service manifest defines:
2+
# - a load balancer for pods matching label "app: node-hello-world"
3+
# - NOT exposing the application to the public Internet (internal load balancer)
4+
# - routes port 80 of the load balancer to the port 8080 of the Pods.
5+
# Syntax reference https://kubernetes.io/docs/concepts/configuration/overview/
6+
apiVersion: v1
7+
kind: Service
8+
metadata:
9+
name: nodejs-hello-world-internal
10+
annotations:
11+
networking.gke.io/load-balancer-type: "Internal"
12+
spec:
13+
type: LoadBalancer
14+
selector:
15+
app: nodejs-hello-world
16+
ports:
17+
- name: http
18+
port: 80
19+
targetPort: 8080

nodejs/nodejs-hello-world/kubernetes-manifests/hello.service.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,5 +13,5 @@ spec:
1313
app: nodejs-hello-world
1414
ports:
1515
- name: http
16-
port: 81
16+
port: 80
1717
targetPort: 8080

nodejs/nodejs-hello-world/skaffold.yaml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,12 @@ build:
1010
image: nodejs-hello-world
1111
deploy:
1212
kubectl:
13-
manifests:
14-
- kubernetes-manifests/**
13+
manifests: ["kubernetes-manifests/hello.deployment.yaml", "kubernetes-manifests/hello.service.yaml"]
1514
profiles:
1615
- name: cloudbuild
1716
build:
1817
googleCloudBuild: {}
18+
- name: internalpool # This profile is for running clusters with internal IP addresses.
19+
deploy:
20+
kubectl:
21+
manifests: ["kubernetes-manifests/hello.deployment.yaml", "kubernetes-manifests/hello.service.internal.yaml"]
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# This Service manifest defines:
2+
# - a load balancer for pods matching label "app: django-python-hello-world"
3+
# - NOT exposing the application to the public Internet (internal load balancer)
4+
# - routes port 80 of the load balancer to the port 8080 of the Pods.
5+
# Syntax reference https://kubernetes.io/docs/concepts/configuration/overview/
6+
apiVersion: v1
7+
kind: Service
8+
metadata:
9+
name: django-python-hello-world-internal
10+
annotations:
11+
networking.gke.io/load-balancer-type: "Internal"
12+
labels:
13+
app: django-python-hello-world
14+
tier: app
15+
spec:
16+
type: LoadBalancer
17+
ports:
18+
- name: http
19+
port: 80
20+
targetPort: 8080
21+
selector:
22+
app: django-python-hello-world
23+
tier: app

python/django/python-hello-world/skaffold.yaml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,13 @@ build:
1212
# defines the Kubernetes manifests to deploy on each run
1313
deploy:
1414
kubectl:
15-
manifests:
16-
- kubernetes-manifests/**.yaml
15+
manifests: ["kubernetes-manifests/hello.deployment.yaml", "kubernetes-manifests/hello.service.yaml"]
1716
# use the cloudbuild profile to build images using Google Cloud Build
1817
profiles:
1918
- name: cloudbuild
2019
build:
2120
googleCloudBuild: {}
21+
- name: internalpool # This profile is for running clusters with internal IP addresses.
22+
deploy:
23+
kubectl:
24+
manifests: ["kubernetes-manifests/hello.deployment.yaml", "kubernetes-manifests/hello.service.internal.yaml"]
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# This Service manifest defines:
2+
# - a load balancer for pods matching label "app: python-hello-world"
3+
# - NOT exposing the application to the public Internet (internal load balancer)
4+
# - routes port 80 of the load balancer to the port 8080 of the Pods.
5+
# Syntax reference https://kubernetes.io/docs/concepts/configuration/overview/
6+
apiVersion: v1
7+
kind: Service
8+
metadata:
9+
name: nodejs-hello-world-internal
10+
annotations:
11+
networking.gke.io/load-balancer-type: "Internal"
12+
spec:
13+
type: LoadBalancer
14+
selector:
15+
app: python-hello-world
16+
ports:
17+
- name: http
18+
port: 80
19+
targetPort: 8080

0 commit comments

Comments
 (0)