---
title: Test your .NET deployment
linkTitle: Test your deployment
weight: 50
keywords: deploy, .net, local, development
description: Learn how to deploy your application
aliases:
- /language/dotnet/deploy/
- /guides/language/dotnet/deploy/
---
## Prerequisites
- Complete all the previous sections of this guide, starting with [Containerize
a .NET application](containerize.md).
- [Turn on Kubernetes](/manuals/desktop/features/kubernetes.md#install-and-turn-on-kubernetes) in Docker
Desktop.
## Overview
In this section, you'll learn how to use Docker Desktop to deploy your
application to a fully-featured Kubernetes environment on your development
machine. This allows you to test and debug your workloads on Kubernetes locally
before deploying.
## Create a Kubernetes YAML file
In your `docker-dotnet-sample` directory, create a file named
`docker-dotnet-kubernetes.yaml`. Open the file in an IDE or text editor and add
the following contents. Replace `DOCKER_USERNAME/REPO_NAME` with your Docker
username and the name of the repository that you created in [Configure CI/CD for
your .NET application](configure-ci-cd.md).
```yaml
apiVersion: apps/v1
kind: Deployment
metadata:
labels:
service: server
name: server
namespace: default
spec:
replicas: 1
selector:
matchLabels:
service: server
strategy: {}
template:
metadata:
labels:
service: server
spec:
initContainers:
- name: wait-for-db
image: busybox:1.28
command:
[
"sh",
"-c",
'until nc -zv db 5432; do echo "waiting for db"; sleep 2; done;',
]
containers:
- image: DOCKER_USERNAME/REPO_NAME
name: server
imagePullPolicy: Always
ports:
- containerPort: 8080
hostPort: 8080
protocol: TCP
resources: {}
restartPolicy: Always
status: {}
---
apiVersion: apps/v1
kind: Deployment
metadata:
labels:
service: db
name: db
namespace: default
spec:
replicas: 1
selector:
matchLabels:
service: db
strategy:
type: Recreate
template:
metadata:
labels:
service: db
spec:
containers:
- env:
- name: POSTGRES_DB
value: example
- name: POSTGRES_PASSWORD
value: example
image: postgres
name: db
ports:
- containerPort: 5432
protocol: TCP
resources: {}
restartPolicy: Always
status: {}
---
apiVersion: v1
kind: Service
metadata:
labels:
service: server
name: server
namespace: default
spec:
type: NodePort
ports:
- name: "8080"
port: 8080
targetPort: 8080
nodePort: 30001
selector:
service: server
status:
loadBalancer: {}
---
apiVersion: v1
kind: Service
metadata:
labels:
service: db
name: db
namespace: default
spec:
ports:
- name: "5432"
port: 5432