<p>We would like to expose our <code>POD</code> to external IP. If we would use <code>AWS LB</code> then it will be available to the public. Are there any alternative solutions?</p>

<p>Here is what I did so far:</p>

<pre><code>{
  "kind": "Service",
  "apiVersion": "v1",
  "metadata": {
    "name": "testing"
  },
  "spec": {
    "ports": [{
      "port": 80,
      "targetPort": 8080
    }],
    "selector": {
      "app": "testing"
    },
    "type": "LoadBalancer"
  }
}
</code></pre>

<p>We like to expose it to only a single IP or a range of external IPs.</p>

<p>You can use the <code>.spec.loadBalancerSourceRanges</code> key, as documented in the <a href="https://kubernetes.io/docs/tasks/access-application-cluster/configure-cloud-provider-firewall/#restrict-access-for-loadbalancer-service" rel="nofollow noreferrer">docs</a>:</p>

<blockquote>
  <p>This field takes a list of IP CIDR ranges, which Kubernetes will use to configure firewall exceptions. This feature is currently supported on Google Compute Engine, Google Kubernetes Engine, AWS Elastic Kubernetes Service, Azure Kubernetes Service, and IBM Cloud Kubernetes Service</p>
</blockquote>
