<p>How to update namespace without changing External-IP of the Service? </p>

<p>Initially, it was without namespace and it was deployed:</p>

<pre><code>kind: Service
metadata:
  name: my-app
  labels:
    app: my-app
spec:
  type: LoadBalancer
  ports:
    port: 80
    protocol: TCP
  selector:
    app: my-app
</code></pre>

<p>It creates External-IP address and it was pointed to the DNS. Now I would like to update the Namespace to keep it more organised. So I have created the namespace.</p>

<pre><code>apiVersion: v1
kind: Namespace
metadata:
  name: my-namespace
</code></pre>

<p>and I have updated the service with a namespace. </p>

<pre><code>kind: Service
metadata:
  name: my-app
  namespace: my-namespace
  labels:
    app: my-app
spec:
  type: LoadBalancer
  ports:
    port: 80
    protocol: TCP
  selector:
    app: my-app
</code></pre>

<p>The above file creates another Service in <code>my-namespace</code> and the External-IP is not the same. Is there a way to update the namespace without recreating? </p>

<p>Please let me know if you need any information. Thanks!</p>

<p>some cloud providers allow you to specify external ip of a service with <a href="https://kubernetes.io/docs/concepts/services-networking/service/#external-ips" rel="nofollow noreferrer">https://kubernetes.io/docs/concepts/services-networking/service/#external-ips</a> if you can ake use of this, you should be able to achieve what you need. This will not be a zero downtime operation though as you'll first need to delete the current service and recreate it under different namespace with externalIP specified.</p>
