How to clear Kubernetes cache

H
Kubernetes is a popular and universally used container orchestration system. It is basically used to create, deploy and manage applications and software. Sometimes, Kubernetes cluster does not start due to some problem in configuration and some unknown reasons. In such situations, users may need to clear the Kubernetes cache or remove Kubernetes components.

This article will clarify:

How to clear the cache of a cluster by deleting the “cache” directory?

Sometimes, users may face difficulty in starting or creating a new Kubernetes cluster. To resolve this issue, the user needs to clear the Kubernetes cache.

To clear Kubernetes cache, see the given steps.

Step 1: Open the “.kube” Directory

To clear the Kubernetes cache, first, open “.HappenBy navigating to “Directory”C:\Users\<उपयोगकर्ता-नाम>” Directory:

Step 2: Clear Kubernetes Cache

,.Happen” folder contains the cache folder that stores the Kubernetes cache. Open “cash” Directory:

This directory will contain two folders, “Search“Directory and”http, Discovery directory is used to storekubectl api-resourcesRequests for each Kubernetes cluster. opposite of this, “http“The directory is used to store the response body generated against each”api-resources” Demand.

To clear the Kubernetes cache, press “CTRL+A” to select all directories. After that, press “delete” Or “ofKeys to clear cache folder:

Here, you can see that we have effectively deleted and cleared the Kubernetes cache:

How to clean up a Kubernetes cluster by deleting nodes and pods?

A Kubernetes cluster does not have a centralized or global Kubernetes cache. Kubernetes Command Line Tool “kubectl“Does not provide any commands to clear the cluster cache. The Kubernetes cluster cache may belong to a Kubernetes component or to applications such as pods and nodes. To clear a Kubernetes cluster, see the demonstration below.

Step 1: Get the Pods

To get Kubernetes cluster pods, use “kubectl get pods“Order:

Step 2: Delete Pods

Next, remove the pods to clean up the cluster using “kubectl delete pod <पॉड-नाम>” Permission:

kubectl delete pod <demo,

Step 3: Get Nodes

To completely clear the cluster cache or application cache running in a Kubernetes cluster, use “get nodes”Kubectl get nodes” Permission:

Step 4: Clear the Node

Next, remove the node to make it unschedulable and delete the node directory data. To do this, use the command below:

Cubectel Drain MiniCube-M02 –Force –ignore-daemonsets –delete-emptydir-data

Step 5: Delete Node

To completely remove a node, simply use “kubectl delete node <नोड-नाम>” Permission:

kubectl delete node minikube-m02

This is all about clearing the Kubernetes cache and clearing the Kubernetes cluster.

conclusion

Kubernetes Cache does not have a centralized cache and does not provide any kubectl commands. To clear the Kubernetes cache, open “.Happen“System Directory”$home” Directory or User Directory. After that, clear all the contents of the directory. To clean up a Kubernetes cluster, remove Kubernetes components such as pods. After that, remove the node and delete it using “kubectl delete node <नोड-नाम>” Command. This post explains how to clear the cache of a Kubernetes cluster.

Add comment

By Ranjan