I have a working GKE cluster serving content at port 80. How do I get the load balancer service to deliver the content on the external (regional reserved) static IP 111.222.333.123?
I see that kubectl get service
shows that the external static IP is successfully registered. The external IP does respond to ping requests.
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
kubernetes ClusterIP 10.16.0.1 <none> 443/TCP 17h
myapp-cluster NodePort 10.16.5.168 <none> 80:30849/TCP 84m
myapp-service LoadBalancer 10.16.9.255 111.222.333.123 80:30879/TCP 6m20s
Additionally, the Google Cloud Platform console shows that the forwarding rule is established and correctly referencing the GKE target pool.
The deployment and service manifest I am using is shown below:
apiVersion: apps/v1
kind: Deployment
metadata:
name: myapp
labels:
app: myapp
spec:
replicas: 2
selector:
matchLabels:
app: myapp
environment: sandbox
template:
metadata:
labels:
app: myapp
environment: sandbox
spec:
containers:
- name: myapp
image: myapp
imagePullPolicy: Always
ports:
- containerPort: 8080
restartPolicy: Always
---
apiVersion: v1
kind: Service
metadata:
name: myapp-service
spec:
selector:
app: myapp
environment: sandbox
ports:
- port: 80
targetPort: 8080
type: LoadBalancer
loadBalancerIP: "111.222.333.123"
The associated skaffold configuration file for reference:
apiVersion: skaffold/v2beta18
kind: Config
metadata:
name: myapp
build:
artifacts:
- image: myapp
context: .
docker: {}
deploy:
kubectl:
manifests:
- gcloud_k8_staticip_deployment.yaml
What am I missing to allow traffic to reach the GKE cluster when running this configuration using Google Cloud Code?
Apologies if this has been asked before. Happy to take a pointer if I missed the right solution reviewing questions.