K8S installation top

Specific steps for installing top in K8S

1. Install manually using the helm assembly

  • 1.1 what is Helm?
    • helm provides tools for collaboration when creating, installing and managing applications within Kubernetes, which is a bit similar to APT in Ubuntu or YUM in CentOS.
  • 1.2 Helm benefits:
    • Find pre packaged software to install and use (Chart)
    • Easily create and host your own packages
    • Install the package into any K8s cluster
    • Query the cluster to see installed and running packages
    • Update, delete, rollback, or view the history of installed packages
  • 1.3 Helm component introduction:
    • Helm:
      • Helm is a client tool on the command line. It is mainly used to create, package, publish Kubernetes application Chart, and create and manage local and remote Chart warehouses.
    • Chart:
      • Helm's software package adopts TAR format. Similar to APT's DEB package or YUM's RPM package, it contains a set of YAML files that define Kubernetes resources.
    • Repoistory:
      • In helm's software warehouse, Repository is essentially a Web server, which saves a series of Chart packages for users to download, and provides a list file of Chart packages of the Repository for query. Helm can manage multiple different repositories at the same time.
    • Release
      • The Chart deployed in the Kubernetes cluster using the helm install command is called Release. It can be understood as an application instance deployed by Helm using Chart package.

2. Install Helm manually

root@130-me-et-node-1:~# wget https://get.helm.sh/helm-v3.3.4-linux-amd64.tar.gz
  • 2.2 tart -zxvf helm-v3.3.4-linux-amd64.tar.gz
root@130-me-et-node-1:~# tart -zxvf helm-v3.3.4-linux-amd64.tar.gz
  • 2.3 mv linux-amd64/helm /usr/local/bin/helm
root@130-me-et-node-1:~# mv linux-amd64/helm /usr/local/bin/helm
  • 2.4 helm version
root@130-me-et-node-1:~# helm version
  • 2.5 add the following command completion
vim ~/.bashrc  #Add the following in the last line:
source <(helm completion bash)
  • 2.6 save and exit source
source ~/.bashrc

3. Install top

  • 3.1 add helm warehouse
root@130-me-et-node-1:~# helm repo add bitnami https://charts.bitnami.com/bitnami
  • 3.2 search for chart name in warehouse
root@130-me-et-node-1:~# helm search repo metrics-server
  • 3.3 installing with helm
root@130-me-et-node-1:~# helm install metrics-server bitnami/metrics-server -n kube-system
  • 3.4 after installation, you will see the following error prompt
# Prompt error
WARNING: Kubernetes configuration file is group-readable. This is insecure. Location: /root/.kube/config
WARNING: Kubernetes configuration file is world-readable. This is insecure. Location: /root/.kube/config
NAME: metrics-server
LAST DEPLOYED: Wed Jan 12 00:56:46 2022
NAMESPACE: kube-system
STATUS: deployed
REVISION: 1
TEST SUITE: None
NOTES:
CHART NAME: metrics-server
CHART VERSION: 5.10.13
APP VERSION: 0.5.2

** Please be patient while the chart is being deployed **

The metric server has been deployed.

###################################################################################
### ERROR: The metrics.k8s.io/v1beta1 API service is not enabled in the cluster ###
###################################################################################
You have disabled the API service creation for this release. As the Kubernetes version in the cluster
does not have metrics.k8s.io/v1beta1, the metrics API will not work with this release unless:

Option A:

  You complete your metrics-server release by running:

  helm upgrade --namespace kube-system metrics-server bitnami/metrics-server \
    --set apiService.create=true

Option B:

   You configure the metrics API service outside of this Helm chart
  • 3.5 solutions are as follows:
root@130-me-et-node-1:~# helm upgrade metrics-server bitnami/metrics-server --set apiService.create=true -n kube-system
 Then you will get the following return value:

NAME: metrics-server

LAST DEPLOYED: Wed Sep 16 01:59:22 2022

NAMESPACE: kube-system

STATUS: deployed

REVISION: 1

TEST SUITE: None

NOTES:

** Please be patient while the chart is being deployed **

The metric server has been deployed.

In a few minutes you should be able to list metrics using the following

command:

kubectl get --raw "/apis/metrics.k8s.io/v1beta1/nodes"
  • 3.6 query according to the command prompted by him to verify whether the installation is successful. If the installation is successful, a pile of values will be returned. If the installation is unsuccessful, use helm merics server status to query the log
root@130-me-et-node-1:~# kubectl get --raw "/apis/metrics.k8s.io/v1beta1/nodes"
  • 3.7 add a value of deploy
kubectl -n kube-system edit deployments.apps metrics-server
 Add the following configuration to the last line
spec:

containers:

- command:

- metrics-server

- secure-port=8443

- kubelet-insecure-tls
  • 3.8 after modification, you can use kubectl top node to view
root@130-me-et-node-1:~# kubectl top node
NAME              CPU(cores)   CPU%   MEMORY(bytes)   MEMORY%   
192.168.117.130   178m         8%     1076Mi          65%       
192.168.117.131   172m         8%     1048Mi          63%       

Keywords: Kubernetes

Added by devdavad on Tue, 11 Jan 2022 20:05:41 +0200