---
title: Test your React.js deployment
linkTitle: Test your deployment
weight: 60
keywords: deploy, kubernetes, react, react.js
description: Learn how to deploy locally to test and debug your Kubernetes deployment
---
## Prerequisites
Before you begin, make sure you’ve completed the following:
- Complete all the previous sections of this guide, starting with [Containerize React.js application](containerize.md).
- [Enable Kubernetes](/manuals/desktop/features/kubernetes.md#install-and-turn-on-kubernetes) in Docker Desktop.
> **New to Kubernetes?**
> Visit the [Kubernetes basics tutorial](https://kubernetes.io/docs/tutorials/kubernetes-basics/) to get familiar with how clusters, pods, deployments, and services work.
---
## Overview
This section guides you through deploying your containerized React.js application locally using [Docker Desktop’s built-in Kubernetes](/desktop/kubernetes/). Running your app in a local Kubernetes cluster allows you to closely simulate a real production environment, enabling you to test, validate, and debug your workloads with confidence before promoting them to staging or production.
---
## Create a Kubernetes YAML file
Follow these steps to define your deployment configuration:
1. In the root of your project, create a new file named: reactjs-sample-kubernetes.yaml
2. Open the file in your IDE or preferred text editor.
3. Add the following configuration, and be sure to replace `{DOCKER_USERNAME}` and `{DOCKERHUB_PROJECT_NAME}` with your actual Docker Hub username and repository name from the previous [Automate your builds with GitHub Actions](configure-github-actions.md).
```yaml
apiVersion: apps/v1
kind: Deployment
metadata:
name: reactjs-sample
namespace: default
spec:
replicas: 1
selector:
matchLabels:
app: reactjs-sample
template:
metadata:
labels:
app: reactjs-sample
spec:
containers:
- name: reactjs-container
image: {DOCKER_USERNAME}/{DOCKERHUB_PROJECT_NAME}:latest
imagePullPolicy: Always
ports:
- containerPort: 8080
---
apiVersion: v1
kind: Service
metadata:
name: reactjs-sample-service
namespace: default
spec:
type: NodePort
selector:
app: reactjs-sample
ports:
- port: 8080
targetPort: 8080
nodePort: 30001
```
This manifest defines two key Kubernetes resources, separated by `---`:
- Deployment
Deploys a single replica of your React.js application inside a pod. The pod uses the Docker image built and pushed by your GitHub Actions CI/CD workflow
(refer to [Automate your builds with GitHub Actions](configure-github-actions.md)).
The container listens on port `8080`, which is typically used by [Nginx](https://nginx.org/en/docs/) to serve your production React app.
- Service (NodePort)
Exposes the deployed pod to your local machine.
It forwards traffic from port `30001` on your host to port `8080` inside the container.
This lets you access the application in your browser at [http://localhost:30001](http://localhost:30001).
> [!NOTE]
> To learn more about Kubernetes objects, see the [Kubernetes documentation](https://kubernetes.io/docs/home/).
---
## Deploy and check your application
Follow these steps to deploy your containerized React.js app into a local Kubernetes cluster and verify that it’s running correctly.
### Step 1. Apply the Kubernetes configuration
In your terminal, navigate to the directory where your `reactjs-sample-kubernetes.yaml` file is located, then deploy the resources using: