Home Explore Blog CI



docker

3rd chunk of `content/guides/dotnet/deploy.md`
166bad08677deb6383e38c2274ad60616409428504522f1c0000000100000b9f
  selector:
    service: db
status:
  loadBalancer: {}
```

In this Kubernetes YAML file, there are four objects, separated by the `---`. In addition to a Service and Deployment for the database, the other two objects are:

- A Deployment, describing a scalable group of identical pods. In this case,
  you'll get just one replica, or copy of your pod. That pod, which is
  described under `template`, has just one container in it. The container is
  created from the image built by GitHub Actions in [Configure CI/CD for your
  .NET application](configure-ci-cd.md).
- A NodePort service, which will route traffic from port 30001 on your host to
  port 8080 inside the pods it routes to, allowing you to reach your app
  from the network.

To learn more about Kubernetes objects, see the [Kubernetes documentation](https://kubernetes.io/docs/home/).

## Deploy and check your application

1. In a terminal, navigate to the `docker-dotnet-sample` directory
   and deploy your application to Kubernetes.

   ```console
   $ kubectl apply -f docker-dotnet-kubernetes.yaml
   ```

   You should see output that looks like the following, indicating your Kubernetes objects were created successfully.

   ```shell
   deployment.apps/db created
   service/db created
   deployment.apps/server created
   service/server created
   ```

2. Make sure everything worked by listing your deployments.

   ```console
   $ kubectl get deployments
   ```

   Your deployment should be listed as follows:

   ```shell
   NAME     READY   UP-TO-DATE   AVAILABLE   AGE
   db       1/1     1            1           76s
   server   1/1     1            1           76s
   ```

   This indicates all of the pods are up and running. Do the same check for your services.

   ```console
   $ kubectl get services
   ```

   You should get output like the following.

   ```shell
   NAME         TYPE        CLUSTER-IP      EXTERNAL-IP   PORT(S)          AGE
   db           ClusterIP   10.96.156.90    <none>        5432/TCP         2m8s
   kubernetes   ClusterIP   10.96.0.1       <none>        443/TCP          164m
   server       NodePort    10.102.94.225   <none>        8080:30001/TCP   2m8s
   ```

   In addition to the default `kubernetes` service, you can see your `server` service and `db` service. The `server` service is accepting traffic on port 30001/TCP.

3. Open a browser and visit your app at `localhost:30001`. You should see your
   application.

4. Run the following command to tear down your application.

   ```console
   $ kubectl delete -f docker-dotnet-kubernetes.yaml
   ```

## Summary

In this section, you learned how to use Docker Desktop to deploy your application to a fully-featured Kubernetes environment on your development machine.

Related information:

- [Kubernetes documentation](https://kubernetes.io/docs/home/)
- [Deploy on Kubernetes with Docker Desktop](/manuals/desktop/features/kubernetes.md)
- [Swarm mode overview](/manuals/engine/swarm/_index.md)

Title: Deploying and Verifying the Application on Kubernetes
Summary
This section explains how to deploy the application to a Kubernetes environment using Docker Desktop. It provides step-by-step instructions, including the command to apply the Kubernetes YAML file (`kubectl apply -f docker-dotnet-kubernetes.yaml`) and verify the deployment status using `kubectl get deployments` and `kubectl get services`. It then instructs the user to visit `localhost:30001` in a browser to view the application. Finally, the section includes the command to tear down the application (`kubectl delete -f docker-dotnet-kubernetes.yaml`) and provides links to related resources like the Kubernetes documentation and Docker Desktop deployment guides.