• Latest
  • Trending
Setup local Kubernetes cluster with Docker Desktop

Setup local Kubernetes cluster with Docker Desktop

July 11, 2022
Absa and Visa Extend Strategic Partnership to Advance Growth and Innovation Across Africa

Absa and Visa Extend Strategic Partnership to Advance Growth and Innovation Across Africa

July 29, 2025
French Telco Orange Hit by Cyber-Attack

French Telco Orange Hit by Cyber-Attack

July 29, 2025
ATC Ghana supports Girls-In-ICT Program

ATC Ghana supports Girls-In-ICT Program

April 25, 2023
Vice President Dr. Bawumia inaugurates  ICT Hub

Vice President Dr. Bawumia inaugurates ICT Hub

April 2, 2023
Co-Creation Hub’s edtech accelerator puts $15M towards African startups

Co-Creation Hub’s edtech accelerator puts $15M towards African startups

February 20, 2023
Data Leak Hits Thousands of NHS Workers

Data Leak Hits Thousands of NHS Workers

February 20, 2023
EU Cybersecurity Agency Warns Against Chinese APTs

EU Cybersecurity Agency Warns Against Chinese APTs

February 20, 2023
How Your Storage System Will Still Be Viable in 5 Years’ Time?

How Your Storage System Will Still Be Viable in 5 Years’ Time?

February 20, 2023
The Broken Promises From Cybersecurity Vendors

Cloud Infrastructure Used By WIP26 For Espionage Attacks on Telcos

February 20, 2023
Instagram and Facebook to get paid-for verification

Instagram and Facebook to get paid-for verification

February 20, 2023
YouTube CEO Susan Wojcicki steps down after nine years

YouTube CEO Susan Wojcicki steps down after nine years

February 20, 2023
Inaugural AfCFTA Conference on Women and Youth in Trade

Inaugural AfCFTA Conference on Women and Youth in Trade

September 6, 2022
  • Consumer Watch
  • Kids Page
  • Directory
  • Events
  • Reviews
Wednesday, 15 April, 2026
  • Login
itechnewsonline.com
  • Home
  • Tech
  • Africa Tech
  • InfoSEC
  • Data Science
  • Data Storage
  • Business
  • Opinion
Subscription
Advertise
No Result
View All Result
itechnewsonline.com
No Result
View All Result

Setup local Kubernetes cluster with Docker Desktop

by ITECHNEWS
July 11, 2022
in Data Science, Leading Stories
0 0
0
Setup local Kubernetes cluster with Docker Desktop

Learn how easy it is to deploy a container on your very own local kubernetes cluster, no need to worry about getting access to a Azure/AWS/GCP subscription. Just follow along.

Here are the Topics we will cover

YOU MAY ALSO LIKE

French Telco Orange Hit by Cyber-Attack

ATC Ghana supports Girls-In-ICT Program

  1. Enable Kubernetes on DockerDesktop
  2. Deploy a “Hello World” app on your local cluster
  3. Deploy a NGINX app & access it from local browser using
  4. Port Forwarding

Pre-requisites:
DockerDesktop

Docker Desktop – Docker

MOST COMMON

favicondocker.com

NOTE: Docker Desktop Stable releases require the Hyper-V feature which is not available in the Windows 10 Home edition.


Enable Kubernetes Cluster on DockerDesktop
You can use other tools such as Minikube or Kind which are also suited for running a single Node Cluster locally.

First and foremost, Enable Kubernetes & Restart Docker Desktop

Docker Desktop

We now have a single-node cluster running on our systems, you can run kubectl commands and play around a bit before getting started.

On checking cluster-info shown below, we find that a master is running, now do remember that this is a single-node cluster i.e. master & worker are are on the same node. (A more practical use-case would have a master and many worker nodes to achieve High Availability-HA).

kubectl cluster info

kubectl get nodes

Check namespaces, not that it’s relevant in this context but remember we will be working in the default namespace.

kubectl get namespaces

Also, you will find a default ‘kubernetes’ service already running on clusterIP.


 

 


Deploy “Hello World” App on the Cluster
Lets start out by deploying a simple “Hello World” application. For this we will create a Deployment and a Service — which connects to the deployment.

Do remember that you can either run kubectl commands directly from a Power shell window or create manifest Yaml file(s) as shown below.

1. Deployment Creation
By creating a manifest file with kind: Deployment, we are essentially creating containers, pods, replicaSets in the background.

deployment.yaml

apiVersion: apps/v1
kind: Deployment
metadata:
  name: hello
spec:
  selector:
    matchLabels:
      app: hello
      version: 2.0.0
  replicas: 2
  template:
    metadata:
      labels:
        app: hello
        version: 2.0.0
    spec:
      containers:
      - name: hello
        image: "gcr.io/google-samples/hello-app:2.0"
        env:
        - name: "PORT"
          value: "50001"

_Translation:

Pull a container from gcr.io/google-samples/hello-app:2.0 and

replicas: 2 means that there will be 2 pods running any point of time._

2. Services — Access the deployment
service.yaml

apiVersion: v1
kind: Service
metadata:
  name: hello-service
spec:
  type: NodePort
  selector:
    app: hello
    version: 2.0.0
  ports:
  - name: http
    protocol: TCP
    port: 8081
    targetPort: 50001
    nodePort: 32000

Here the ‘hello-service’ connects to all the pods created above having name ‘hello’ as mentioned by the selector attribute at targetPort=50001

Remember, we are creating a NodePort service to enable access from outside the cluster. From within the cluster, all the pods are accessible through ClusterIP.

Hello World is deployed and is accessible through nodePort, http://localhost:32000/

Hello, world!
Version: 2.0.0
Hostname: hello-fdf67c7-b4fs4


Deploying Nginx in 3 steps

We will be deploying an nginx:alpine image (from the public docker hub registry) onto a local kubernetes cluster running on our DockerDesktop.

1. Create Deployment

Lets create nginx deployment, this will create a Deployment and a Pod

kubectl create deploy nginx —image=nginx:alpine

2. Create Service to expose deployment

We want our nginx app to be accessible from any pod within cluster, so we expose it.

kubectl expose deploy nginx --port=80 --target-port=8000

Verify if this nginx app is accessible from any other pod within the cluster, add a ubuntu test pod and run curl on the Pod IP

# lets connect to the nginx app using clusterIP
$ kubectl get service nginx
NAME    TYPE        CLUSTER-IP     EXTERNAL-IP   PORT(S)   AGE
nginx   ClusterIP   10.106.163.0   <none>        80/TCP    25h
# spin up a test ubuntu pod
$ kubectl run -i --tty ubuntu --image=ubuntu --restart=Never -- sh
# check connectivity through PodIP and Port
$ curl http://10.1.0.13:80

BINGO !! we can reach the nginx deployment from within cluster

3. Access the deployment from outside the cluster (locally)

Now we want to make this nginx deployment accessible from outside the cluster.

Do remember that each Pod within a Cluster has a unique IP address, which can be accessed from outside the cluster through a Service, but if you are running cluster locally this can be easily achieved through Port Forwarding.

Port Forwarding will allow you to connect to a Pod on a forwarded(different) port from you local machine, without exposing the Services.

Use Port Forwarding to Access Applications in a Cluster | KubernetesUse Port Forwarding to Access Applications in a Cluster | Kubernetes

This page shows how to use kubectl port-forward to connect to a MongoDB server running in a Kubernetes cluster. This type of connection can be useful for database debugging. Before you begin You need to have a Kubernetes cluster, and the kubectl command-line tool must be configured to communicate with your cluster. It is recommended to run this tutorial on a cluster with at least two nodes that are not acting as control plane hosts.

kubernetes.io

Lets port-forward our nginx deployment to a random port.

$ kubectl port-forward deployment/nginx :80
Forwarding from 127.0.0.1:56271 -> 80
Forwarding from [::1]:56271 -> 80
Handling connection for 56271
Handling connection for 56271
Handling connection for 56271
Handling connection for 56271

Open up your browser and point to the localhost:56271 (forwarded port)

Nginx Welcome Page

NOTE: Port-Forwarding need to be running all the time for this to work

Hope this blog helps you in getting started with kubernetes.

It’s an open ground, Play around !!

Source: Sayed Naweed Rizvi
Tags: Setup local Kubernetes cluster with Docker Desktop
ShareTweet

Get real time update about this post categories directly on your device, subscribe now.

Unsubscribe

Search

No Result
View All Result

Recent News

Absa and Visa Extend Strategic Partnership to Advance Growth and Innovation Across Africa

Absa and Visa Extend Strategic Partnership to Advance Growth and Innovation Across Africa

July 29, 2025
French Telco Orange Hit by Cyber-Attack

French Telco Orange Hit by Cyber-Attack

July 29, 2025
ATC Ghana supports Girls-In-ICT Program

ATC Ghana supports Girls-In-ICT Program

April 25, 2023

About What We Do

itechnewsonline.com

We bring you the best Premium Tech News.

Recent News With Image

Absa and Visa Extend Strategic Partnership to Advance Growth and Innovation Across Africa

Absa and Visa Extend Strategic Partnership to Advance Growth and Innovation Across Africa

July 29, 2025
French Telco Orange Hit by Cyber-Attack

French Telco Orange Hit by Cyber-Attack

July 29, 2025

Recent News

  • Absa and Visa Extend Strategic Partnership to Advance Growth and Innovation Across Africa July 29, 2025
  • French Telco Orange Hit by Cyber-Attack July 29, 2025
  • ATC Ghana supports Girls-In-ICT Program April 25, 2023
  • Vice President Dr. Bawumia inaugurates ICT Hub April 2, 2023
  • Home
  • InfoSec
  • Opinion
  • Africa Tech
  • Data Storage

© Copyright 2026, All Rights Reserved | iTechNewsOnline.Com - Powered by BackUPDataSystems

Welcome Back!

Login to your account below

Forgotten Password?

Retrieve your password

Please enter your username or email address to reset your password.

Log In

Add New Playlist

No Result
View All Result
  • Home
  • Tech
  • Africa Tech
  • InfoSEC
  • Data Science
  • Data Storage
  • Business
  • Opinion

© Copyright 2026, All Rights Reserved | iTechNewsOnline.Com - Powered by BackUPDataSystems

Are you sure want to unlock this post?
Unlock left : 0
Are you sure want to cancel subscription?
Go to mobile version