title: Kubernetes kubectl update service selector
body: <p>My Kubernetes cluster is running under Google Cloud. I have deployment which running with port 443 and LoadBalancer expose it to the internet. </p>
  
  <p>I created it in this way:</p>
  
  <pre><code>kubectl expose deployment my-app --target-port=443 --port=443 --type=LoadBalancer
  </code></pre>
  
  <p>After running this command, the loadbalancer is pointing to <code>my-app</code> deployment. Now I created <code>my-app2</code> and I want to change the loadbalancer to point the new deployment (<code>my-app2</code>).</p>
  
  <p><strong>Note:</strong> Delete and re-create the deployment is releasing the external IP address and I want to avoid it. </p>
  
  <p>How to patch the existing service to point another deployment <em>without</em> loosing the external IP?</p>