<p>In K8s world and in the shell script i have below content</p>
<pre><code>#!/bin/bash
docker build -t imagename:1 .

kubectl delete -f services/nodeport.service.yml
kubectl delete -f deployments/springapsimplehellopod.deployment.yml
kubectl apply -f deployments/springapsimplehellopod.deployment.yml
kubectl apply -f services/nodeport.service.yml
kubectl apply -f services/loadbalancer.service.yml
</code></pre>
<p>Am i following correct standards ? What is disadvantages of not using image registry rather built image will be kept in local docker and from the newly created image i am creating deployments and services</p>

Nagappa L M
<p>As you are using script, you can just point folder with your YAMLs. It's mentioned in <a href="https://kubernetes.io/docs/concepts/configuration/overview/#using-kubectl" rel="nofollow noreferrer">Kubernetes docs</a></p>
<blockquote>
<p>Use <code>kubectl apply -f &lt;directory&gt;</code>. This looks for Kubernetes configuration in all <code>.yaml</code>, <code>.yml</code>, and <code>.json</code> files in  and passes it to apply.</p>
</blockquote>
<pre><code>$ kubectl apply -f ./tst
service/nginx created
statefulset.apps/web created
service/nginx unchanged
persistentvolume/pv0003 created
</code></pre>
<p>Also you don't need to delete your deployments, as <code>kubectl apply</code> will reconfigure deployment.</p>
<pre><code>$ kubectl apply -f deployment.yaml
deployment.apps/mywebtestapp-deployment created
user@cloudshell:~ (project)$ vi deployment.yaml             # editing container name from nginx to httpd
user@cloudshell:~ (project)$ kubectl apply -f deployment.yaml
deployment.apps/mywebtestapp-deployment configured
</code></pre>
<p>Until you will want to change <code>immutable</code> field.</p>
<pre><code>The Service &quot;nginx&quot; is invalid: spec.clusterIP: Invalid value: &quot;&quot;: field is immutable
</code></pre>
<p>In this situation you would need to delete this resource and create new one.</p>
<p>Regarding best practice using image registry it might be opinion based and depends on your needs.
You can check <a href="https://thenewstack.io/how-a-container-registry-can-both-save-and-harm/" rel="nofollow noreferrer">this article</a> or check <a href="https://softwareengineering.stackexchange.com/questions/369591/what-are-the-advantages-running-a-local-docker-registry">this thread</a>.</p>
<p>You could also check <a href="https://helm.sh/" rel="nofollow noreferrer">Helm - The package manager for Kubernetes</a> if you would like for example divide your application into helm charts.</p>
