Validating the Kubernetes cluster

We will validate the K8s cluster configured using kubeadm in the previous article and we will also deploy the sample deployment and will ensure everything is working as it should be.

  1. Validating CMD Tools

Ensure kubeadm and kubectl version is as per your cluster setup.

$ kubeadm version
$ kubeadm version --short 

2. Validating Cluster Nodes

Ensure all nodes including Master and Worker nodes are Ready state.

$ kubectl get nodes 
$ kubectl get nodes -o wide

3. Validating Kubernetes Components

Ensure all K8s Master node components are in Running state.

$ kubectl get pods -n kube-system
$ kubectl get pods -n kube-system -o wide

4. Validating Services: Docker & Kubelet

Ensure Docker and Kubelet Services are “Active(Running) and Enabled on all nodes.

$ systemctl status docker 
$ systemctl status kubelet

5. Deploying the Nginx application.

a) Let's create a deployment on the master node named “Nginx-deploy” using YAML.

$ vi nginx-deploy.yaml

Deployment YAML file should like below

apiVersion: apps/v1
kind: Deployment
metadata:
name: nginx-deployment
labels:
app: nginx-app
spec:
replicas: 1
selector:
matchLabels:
app: nginx-app
template:
metadata:
labels:
app: nginx-app
spec:
containers:
- name: nginx-container
image: nginx:latest
ports:
- containerPort: 80

b) Let's create a pod using kubectl command

$ kubectl apply -f nginx-deploy.yaml

c) Let's check Pod status

$ kubectl get pods
$ kubectl get pods -o wide

d) Expose the Nginx deployment using Kubernetes NodePort (32001) service

$ vi nginx-service.yaml

e) Service YAML file

apiVersion: v1
kind: Service
metadata:
name: nginx-app
spec:
selector:
app: nginx-app
type: NodePort
ports:
- port: 80
targetPort: 80
nodePort: 32001

f) Create a Service using the kubectl command

$ kubectl apply -f nginx-service.yaml

g) Check the service

$ kubectl get service

In my case pods are running, on worker node 1,

f) Now access the Nginx service by using worker node-1 IP and port 32001, make sure ports are open.

Also, check

Kubernetes Tutorials

--

--

--

DevOps Engineer

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

Who wants to be a musician-slash-consultant-slash-engineer?

Free Algebra in Scala with Java Visitor Pattern

Code Like a Professional

Image of a laptop on a desk

Explained | Domain Driven Design

A Novice’s Guide to Mod’ing (or Managing) a Twitch Channel

Run ML predictions with R on AWS Lambda

Engineering Journal: SDC

How to make CRUD REST API/Service with Yesod Web Framework

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Bikram

Bikram

DevOps Engineer

More from Medium

Helm — Package Manager for Kubernetes

Kubernetes Application High-Availability — Part 1 (The Very-Basic Basics)

Prometheus installation in Google Kubernetes Engine

Node Selectors in Kubernetes