Deploying applications on Kubernetes has become the go-to choice for developers due to its robust orchestration capabilities and vibrant ecosystem. As we move into 2025, deploying a simple app on Kubernetes remains a streamlined process, though some advancements and best practices have evolved. This guide will walk you through deploying a basic application on Kubernetes step-by-step.
Prerequisites
Before you begin, ensure you have the following:
- Kubernetes Cluster: You need access to a Kubernetes cluster. This could be a local setup using Minikube or a remote cloud-based solution such as Google Kubernetes Engine (GKE), Amazon EKS, or Azure AKS.
- Kubectl: Ensure you have kubectl installed on your machine to interact with the Kubernetes cluster.
- Docker: Your application should be containerized using Docker. Install Docker to create and manage your application container.
- YAML Knowledge: Familiarity with writing YAML files is essential for creating Kubernetes manifests.
Step 1: Containerize Your Application
Ensure your application is containerized. Here’s a simple Dockerfile example:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 |
# Use a base image FROM node:16 # Set the working directory WORKDIR /app # Copy application files COPY . . # Install dependencies RUN npm install # Expose the application port EXPOSE 3000 # Start the application CMD ["npm", "start"] |
Build your Docker image:
1
|
docker build -t yourusername/simple-app:1.0 .
|
Step 2: Push Your Docker Image to a Registry
Push your Docker image to a container registry so it can be accessed by Kubernetes.
1
|
docker push yourusername/simple-app:1.0
|
Step 3: Deploy to Kubernetes
Create a deployment YAML file for your application.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
apiVersion: apps/v1 kind: Deployment metadata: name: simple-app-deployment spec: replicas: 3 selector: matchLabels: app: simple-app template: metadata: labels: app: simple-app spec: containers: - name: simple-app image: yourusername/simple-app:1.0 ports: - containerPort: 3000 |
Apply the deployment:
1
|
kubectl apply -f deployment.yaml
|
Create a service to expose your app:
1 2 3 4 5 6 7 8 9 10 11 |
apiVersion: v1 kind: Service metadata: name: simple-app-service spec: type: LoadBalancer ports: - port: 80 targetPort: 3000 selector: app: simple-app |
Apply the service:
1
|
kubectl apply -f service.yaml
|
Step 4: Verify Deployment
To verify that your application is running, use:
1 2 3 |
kubectl get deployments kubectl get pods kubectl get services |
Access your application via the external IP provided by the LoadBalancer service.
Additional Resources
For more detailed guides and advanced deployment scenarios, consider checking out related guides such as:
- WordPress on Kubernetes Guide for deploying complex applications like WordPress.
- Kubernetes Deployment for adding custom configurations to Helm charts.
- DigitalOcean Kubernetes for deploying apps from GitHub Actions to DigitalOcean Kubernetes.
Conclusion
Deploying a simple app on Kubernetes in 2025 can still be achieved through a few straightforward steps. By following the guidelines outlined in this guide, you can get your simple application up and running on a Kubernetes cluster with ease.
Ensure you stay updated with the latest Kubernetes advancements to take advantage of improved features and capabilities as they continue to develop.