<p>I have a very simple spring-boot Hello World program. When I run the application locally, I can navigate to <a href="http://localhost:8080/" rel="nofollow noreferrer">http://localhost:8080/</a> and see the "Hello World" greeting displayed on the page. I have also created a Dockerfile and can build an image from it.</p>

<p>My next goal is to deploy this to a local Kubernetes cluster. I have used Docker Desktop to create a local kubernetes cluster. I want to create a deployment for my application, host it locally on the cluster, and access it from a browser. </p>

<p>I am not sure where to start with this deployment. I know that I will need to create charts, but I have no idea how to ultimately push this image to my cluster...</p>

Mike Ippolito
<p>You need to create a kubernetes <code>deployment</code> and <code>service</code> definitions respectively.</p>

<p>These definitions can be in json or yaml format. Here is example definitions, you can use these definitions as template for your deploy.</p>

<pre><code>apiVersion: apps/v1
kind: Deployment
metadata:
  name: your-very-first-deployment
  labels:
    app: first-deployment
spec:
  replicas: 1
  selector:
    matchLabels:
      app: first-deployment
  template:
    metadata:
      labels:
        app: first-deployment
    spec:
      containers:
      - name: your-app
        image: your-image:with-version
        ports:
        - containerPort: 8080
---
apiVersion: v1
kind: Service
metadata:
  name: your-service
spec:
  type: NodePort
  ports:
    - port: 80
      nodePort: 30180
      targetPort: 8080
  selector:
    app: first-deployment
</code></pre>

<p><strong>Do not forget to</strong> update image line in deployment yaml with your <code>image name</code> and <code>image version</code>. After that replacement, save this file with name for example <code>deployment.yaml</code> and then <code>apply</code> this definition with <code>kubectl apply -f deployment.yml</code> command.</p>

<p><strong>Note that</strong>, you need to use <code>port 30180</code> to access your application as it is stated in <code>service</code> definition as <code>nodePort</code> value. (<a href="http://localhost:30180" rel="nofollow noreferrer">http://localhost:30180</a>)</p>

<p><em>Links</em>: </p>

<p>Kubernetes services: <a href="https://kubernetes.io/docs/concepts/services-networking/service/" rel="nofollow noreferrer">https://kubernetes.io/docs/concepts/services-networking/service/</a></p>

<p>Kubernetes deployments: <a href="https://kubernetes.io/docs/concepts/workloads/controllers/deployment/" rel="nofollow noreferrer">https://kubernetes.io/docs/concepts/workloads/controllers/deployment/</a></p>
