In this article:
Installing Pods Metrics Service
Installing the Prometheus Application
Installing the Grafana Application
For the Kubernetes cluster install the following additional components on the first main node:
The Prometheus application for storing pods metrics.
The Grafana application for Kubernetes components monitoring.
To install pods metrics service:
Execute commands:
helm repo add metrics-server https://kubernetes-sigs.github.io/metrics-server/
helm upgrade --install metrics-server metrics-server/metrics-server -n monitoring --create-namespace
Disable tls check if the certificate is not used:
Execute the command:
kubectl edit deployment metrics-server -n monitoring
Add the string to the spec containers args section:
- --kubelet-insecure-tls
kubectl get pods -n monitoring
After executing the operations the pods metrics service is installed on the main node.
To install the Prometheus application:
helm repo add prometheus-community https://prometheus-community.github.io/helm-charts
helm repo update
helm upgrade --install prometheus prometheus-community/kube-prometheus-stack \
-n monitoring \
--create-namespace \
--version 55.0.0
After executing the operations the Prometheus application is installed on the main node.
To install the Grafana application:
Create an ingress rule for the Grafana application. To do this, create the grafana-ingress.yaml file with contents:
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: grafana-dashboard
namespace: monitoring
spec:
ingressClassName: nginx
rules:
- host: <host>
http:
paths:
- path: /
pathType: ImplementationSpecific
backend:
service:
name: prometheus-grafana
port:
number: 80
In the <host> substitution specify IP address or DNS name, by which the Grafana application is available. Make sure that the host corresponds to the IP addresses specified in the metalb-config.yaml file on metallb component installation. All hosts, with which Kubernetes communicates, should be resolved to these IP addresses.
Apply the ingress rule:
kubectl apply -f grafana-ingress.yaml
After executing the operations and going to the specified host, the Grafana application is available on the main node.
To install cluster web interface:
Install the web interface component:
helm repo add kubernetes-dashboard https://kubernetes.github.io/dashboard/
helm repo update
helm upgrade --install kubernetes-dashboard kubernetes-dashboard/kubernetes-dashboard --create-namespace --namespace kubernetes-dashboard
Create an ingress rule for the web interface component. To do this, create the ingress-dashboard.yaml file with contents:
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: kubernetes-dashboard
annotations:
nginx.ingress.kubernetes.io/backend-protocol: HTTPS
spec:
ingressClassName: nginx
rules:
- host: <host>
http:
paths:
- path: /
pathType: ImplementationSpecific
backend:
service:
name: kubernetes-dashboard-kong-proxy
port:
number: 443
In the <host> substitution specify IP address or DNS name, by which the Grafana application is available. Make sure that the host corresponds to the IP addresses specified in the metalb-config.yaml file on metallb component installation. All hosts, with which Kubernetes communicates, should be resolved to these IP addresses.
Apply the ingress rule:
kubectl apply -f ingress-dashboard.yaml -n kubernetes-dashboard
After executing the operations and going to the specified host, the cluster web interface is available on the main node. The access requires a special key generated during cluster administrator account creation.
To create a cluster administrator account:
Create the cluster-admin-service-account.yaml file with contents:
apiVersion: v1
kind: ServiceAccount
metadata:
name: cluster-admin
namespace: kube-system
Create an administrator based on the settings specified in the cluster-admin-service-account.yaml file:
kubectl apply -f cluster-admin-service-account.yaml
Grant permissions to the administrator:
kubectl create clusterrolebinding cluster-admin-binding --clusterrole=cluster-admin --serviceaccount=kube-system:cluster-admin
Create a special key:
kubectl -n kube-system create token cluster-admin
After executing the operations the administrator account is created on the main node. The special key is used to access the cluster web interface.
Next, install the Docker image local storage or install Foresight Mobile Platform from external repository.
See also:
Cluster Configuration | Preparation and Deployment of Fault-Tolerant Cluster Based on Kubernetes | Installing Docker Image Local Storage