<p>I understand that we can expose the serive as loadbalancer. </p>

<pre><code>kubectl expose deployment hello-world --type=LoadBalancer --name=my-service
</code></pre>

<pre><code>kubectl get services my-service
 NAME         TYPE           CLUSTER-IP     EXTERNAL-IP      PORT(S)    AGE
 my-service   LoadBalancer   10.3.245.137   104.198.205.71   8080/TCP   54s
</code></pre>

<pre><code> Namespace:      default
 Labels:         app.kubernetes.io/name=load-balancer-example
 Annotations:    &lt;none&gt;
 Selector:       app.kubernetes.io/name=load-balancer-example
 Type:           LoadBalancer
 IP:             10.3.245.137
 LoadBalancer Ingress:   104.198.205.71
</code></pre>

<p>I have created a static IP.</p>

<p>Is it possible to replace the <strong>LoadBalancer Ingress</strong> with static IP? </p>

<p>tl;dr = yes, but trying to edit the IP in that <code>Service</code> resource won't do what you expect -- it's just reporting the current state of the world to you</p>

<blockquote>
  <p>Is it possible to replace the LoadBalancer Ingress with static IP? </p>
</blockquote>

<p>First, the LoadBalancer is whatever your cloud provider created when kubernetes asked it to create one; you have <a href="https://kubernetes.io/docs/concepts/services-networking/service/#other-elb-annotations" rel="nofollow noreferrer">a lot of annotations</a> (that one is for AWS, but there should be ones for your cloud provider, too) that influence the creation, and it appears <a href="https://github.com/kubernetes/kubernetes/blob/v1.18.4/staging/src/k8s.io/legacy-cloud-providers/aws/aws.go#L212" rel="nofollow noreferrer">EIPs for NLBs</a> is one of them, but I doubt that does what you're asking</p>

<p>Second, the <code>type: LoadBalancer</code> is merely convenience -- it's not required to expose your <code>Service</code> outside of the cluster. It's a replacement for creating a <code>Service</code> of <code>type: NodePort</code>, then creating an external load balancer resource, associating all the Nodes in your cluster with that load balancer, pointing to the NodePort on the Node to get traffic from the outside world into the cluster. If you already have a static IP-ed load balacer, you can update its registration to point to the NodePort allocations for your existing <code>my-service</code> and you'll be back in business</p>
