<p>I have a phpmyadmin service running on kubernetes cluster. I want to reserve an External IP (static) on google cloud to use with this service so that it could be reachable from the internet.
I have tried reserving an IP address on GCP and used it in the kubernetes service file as below:</p>
<pre><code>apiVersion: v1
kind: Service
metadata:
  annotations:
    kompose.cmd: /snap/kompose/19/kompose-linux-amd64 convert
    kompose.version: 1.21.0 (992df58d8)
  creationTimestamp: null
  labels:
    io.kompose.service: phpmyadmin
  name: phpmyadmin
spec:
  externalIPs: [xx.xxx.xxx.xxx]  #the external IP from Google cloud
  ports:
  - name: &quot;8080&quot;
    port: 8080
    targetPort: 80
  selector:
    io.kompose.service: phpmyadmin
status:
  loadBalancer: {}
</code></pre>
<p>When I specify the <code>spec.type: LoadBalancer</code> then the service is accessible from the internet with the default IP address that is generated from the <code>type: LoadBalancer </code>.</p>
<p>I tried to change firewall rules for the External IP address by allowing Ingress on port 8080, but that did not work.</p>

Kavya
<p>Instead of setting the <code>exteranlIPs</code>, you should set the <code>spec.loadBalancerIP</code> with the <code>spec.type</code> being of <code>LoadBalancer</code> value:</p>
<pre><code>apiVersion: v1
kind: Service
metadata:
  annotations:
    kompose.cmd: /snap/kompose/19/kompose-linux-amd64 convert
    kompose.version: 1.21.0 (992df58d8)
  creationTimestamp: null
  labels:
    io.kompose.service: phpmyadmin
  name: phpmyadmin
spec:
  ports:
  - name: &quot;8080&quot;
    port: 8080
    targetPort: 80
  selector:
    io.kompose.service: phpmyadmin
  type: LoadBalancer
  loadBalancerIP: &quot;YOUR_IP_ADDRESS&quot;
status:
  loadBalancer: {}
</code></pre>
<p><a href="https://cloud.google.com/kubernetes-engine/docs/tutorials/configuring-domain-name-static-ip#exposing_your_application" rel="nofollow noreferrer">Note that exposing your Pods through an external static IP only supports regional load balanced traffic hence your reserved static IP address needs to be regional.</a></p>
<p>For a global IP address, you need to expose a <em>HTTP(s) Load Balancer</em> through an <code>Ingress</code> object.</p>
