<p>I need help to understand how can I update my svc configuration using a json file : my svc is up and runing but it is not the type i want, it is a cluster ip and I'd like to change it to a ingress kind and type load balancer:
curently here is the service :</p>
<pre><code>kubectl -n nifitest get svc -o wide
simplenifi-all-node   ClusterIP      192.164.115.193   &lt;none&gt;          8080/TCP,6007/TCP,10000/TCP   44h   app=nifi,nifi_cr=simplenifi

</code></pre>
<p>now I want to deploy a service that point to the ingress</p>
<p>so is tere a kubectl command like apply to use a json file and will it update the svc using a json file ?</p>
<p>Thank you for your help</p>

Ait Zaid
<p>You need to create new service with loadbalancer type. You cannot update the previous one (from <code>type: ClusterIP</code> to <code>type: LoadBalancer</code>) cause it is immutable.</p>
<p>By the way, I have given the format of loadbalancer service in both <code>yaml</code> and <code>json</code> as an example template, you can use them according to your need.</p>
<p>In Json format:</p>
<pre><code>{
   &quot;apiVersion&quot;: &quot;v1&quot;,
   &quot;kind&quot;: &quot;Service&quot;,
   &quot;metadata&quot;: {
      &quot;name&quot;: &quot;my-service&quot;
   },
   &quot;spec&quot;: {
      &quot;selector&quot;: {
         &quot;app&quot;: &quot;MyApp&quot;
      },
      &quot;ports&quot;: [
         {
            &quot;protocol&quot;: &quot;TCP&quot;,
            &quot;port&quot;: 80,
            &quot;targetPort&quot;: 9376
         }
      ],
      &quot;clusterIP&quot;: &quot;192.164.115.193&quot;,
      &quot;type&quot;: &quot;LoadBalancer&quot;
   },
   &quot;status&quot;: {
      &quot;loadBalancer&quot;: {
         &quot;ingress&quot;: [
            {
               &quot;ip&quot;: &quot;192.0.2.127&quot;
            }
         ]
      }
   }
}
</code></pre>
<p>In Yaml format:</p>
<pre><code>apiVersion: v1
kind: Service
metadata:
  name: my-service
spec:
  selector:
    app: MyApp
  ports:
    - protocol: TCP
      port: 80
      targetPort: 9376
  clusterIP: 192.164.115.193
  type: LoadBalancer
status:
  loadBalancer:
    ingress:
    - ip: 192.0.2.127
</code></pre>
