Docker Desktop Kubernetes Deployment Demystified: Leveraging Ingress, Services, and Deployments

Abdul Gaffoor. Noor Basha
3 min readNov 9, 2023

--

The goal of this Medium article is to provide a comprehensive, step-by-step guide to deploying any application on Docker Desktop with Kubernetes workloads, emphasizing the essential components of Ingress, Services, and Deployments. This technical guide is designed to empower developers and IT professionals with the knowledge and skills needed to harness the full potential of Docker Desktop for Kubernetes deployment.

Prerequisites

Before diving into the deployment process, there are a few prerequisites you need to have in place:

  • Docker Desktop with Kubernetes Enabled
  • Ingress Controller for Local(i.e., Ingress-Nginx Controller)
  • Find the hosts file(C:\Windows\System32\drivers\etc) in your Windows machine
  • Note: I used, kubectl alias as k it in my local

Deployment Steps

  • Create a Deployment with the below manifest file(deployment.yaml)
apiVersion: apps/v1
kind: Deployment
metadata:
labels:
app: demo
name: nginx-deployment
spec:
replicas: 1
selector:
matchLabels:
app: demo
template:
metadata:
labels:
app: demo
spec:
containers:
- image: nginx
name: nginx
ports:
- containerPort: 80
resources:
requests:
memory: "64Mi"
cpu: "0.5"
limits:
memory: "128Mi"
cpu: "1"
  • Create a Service with the below manifest file(service.yaml)
apiVersion: v1
kind: Service
metadata:
labels:
app: demo
name: nginx-service
spec:
ports:
- port: 80
protocol: TCP
targetPort: 80
selector:
app: demo
kubectl get pods --namespace=ingress-nginx
  • Create an Ingress with the below manifest file(ingress.yaml)
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: nginx-ingress
spec:
ingressClassName: nginx
rules:
- host: nginx.abdulgaffoor.local
http:
paths:
- backend:
service:
name: nginx-service
port:
number: 80
path: /
pathType: Prefix
  • Add nginx.abdulgaffoor.local in host file
  • By having all the manifests files in a single directory, run the below command to deploy in the k8s cluster

kubectl apply -f .

  • Check the status of deployments, service, and ingress with commands shown below

In summary, this guide has equipped you with the essential skills to deploy applications on Docker Desktop with Kubernetes. By mastering Ingress, Services, and Deployments, you’ve taken a significant step toward efficient container orchestration. Now, it’s your turn to put this knowledge into action and streamline your application deployment processes. Happy deploying!

--

--

Abdul Gaffoor. Noor Basha

DevOps Engineer || AWS Cloud Admin || Cloud-native Practioner