Установка minikube, helm и dashboard

Все действия проделывались на CentOS 8.


Установка Docker

yum install -y yum-utils
yum-config-manager \
    --add-repo \
    https://download.docker.com/linux/centos/docker-ce.repo
yum -y install docker-ce docker-ce-cli containerd.io
systemctl enable --now docker

Установка Docker Compose

curl -L "https://github.com/docker/compose/releases/download/1.29.2/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose

Установка Minikube

curl -Lo minikube https://storage.googleapis.com/minikube/releases/latest/minikube-linux-amd64
chmod +x ./minikube
install minikube /usr/bin/
yum -y install conntrack
minikube start --driver=none
* minikube v1.23.2 on Centos 8.4.2105 (amd64)
* Using the none driver based on user configuration
* Starting control plane node minikube in cluster minikube
* Running on localhost (CPUs=2, Memory=3640MB, Disk=38324MB) ...
* OS release is CentOS Linux 8
    > kubectl: 44.73 MiB / 44.73 MiB [------------] 100.00% 83.51 MiB p/s 700ms
    > kubelet: 146.25 MiB / 146.25 MiB [-----------] 100.00% 84.76 MiB p/s 1.9s
  - Generating certificates and keys ...
  - Booting up control plane ...
  - Configuring RBAC rules ...
* Configuring local host environment ...
*
! The 'none' driver is designed for experts who need to integrate with an existing VM
* Most users should use the newer 'docker' driver instead, which does not require root!
* For more information, see: https://minikube.sigs.k8s.io/docs/reference/drivers/none/
*
! kubectl and minikube configuration will be stored in /root
! To use kubectl or minikube commands as your own user, you may need to relocate them. For example, to overwrite your own settings, run:
*
  - sudo mv /root/.kube /root/.minikube $HOME
  - sudo chown -R $USER $HOME/.kube $HOME/.minikube
*
* This can also be done automatically by setting the env var CHANGE_MINIKUBE_NONE_USER=true
* Verifying Kubernetes components...
  - Using image gcr.io/k8s-minikube/storage-provisioner:v5
* Enabled addons: storage-provisioner, default-storageclass
* Done! kubectl is now configured to use "minikube" cluster and "default" namespace by default
minikube status
minikube
type: Control Plane
host: Running
kubelet: Running
apiserver: Running
kubeconfig: Configured
В дальнейшем minikube запускаем командой minikube start.

Установка Kubectl

curl -LO https://storage.googleapis.com/kubernetes-release/release/`curl -s https://storage.googleapis.com/kubernetes-release/release/stable.txt`/bin/linux/amd64/kubectl
chmod +x kubectl
mv ./kubectl /usr/local/bin
kubectl version
Client Version: version.Info{Major:"1", Minor:"22", GitVersion:"v1.22.2", GitCommit:"8b5a19147530eaac9476b0ab82980b4088bbc1b2", GitTreeState:"clean", BuildDate:"2021-09-15T21:38:50Z", GoVersion:"go1.16.8", Compiler:"gc", Platform:"linux/amd64"}
Server Version: version.Info{Major:"1", Minor:"22", GitVersion:"v1.22.2", GitCommit:"8b5a19147530eaac9476b0ab82980b4088bbc1b2", GitTreeState:"clean", BuildDate:"2021-09-15T21:32:41Z", GoVersion:"go1.16.8", Compiler:"gc", Platform:"linux/amd64"}

Установка kubectx и kubens

kubectx - утилита управления и переключения между контекстами.
kubens - утилита для быстрого переключения между неймспейсами.

git clone https://github.com/ahmetb/kubectx /opt/kubectx
ln -s /opt/kubectx/kubectx /usr/local/bin/kubectx
ln -s /opt/kubectx/kubens /usr/local/bin/kubens

Установка Helm

curl -fsSL -o get_helm.sh https://raw.githubusercontent.com/helm/helm/main/scripts/get-helm-3
chmod 700 get_helm.sh
./get_helm.sh
Downloading https://get.helm.sh/helm-v3.7.0-linux-amd64.tar.gz
Verifying checksum... Done.
Preparing to install helm into /usr/local/bin
helm installed into /usr/local/bin/helm

Установка Kubernetes Dashboard

Включение компонентов дашборда

minikube addons enable dashboard
minikube addons enable ingress
minikube addons enable metrics-server

Ingress для дашборда (dashboard-ingress.yaml)

Создадим неймспейс:
kubectl create namespace kubernetes-dashboard

Затем создадим ingress для дашборда в файле dashboard-ingress.yaml:
apiVersion: networking.k8s.io/v1
kind: Ingress
metadаta:
  name: dashboard-ingress
  namespace: kubernetes-dashboard
spec:
  rules:
  - host: dashboard.com
    http:
      paths:
        - path: /
          pathType: Prefix
          backend:
            service:
              name: kubernetes-dashboard
              port:
                number: 80

И применим его:
kubectl apply -f dashboard-ingress.yaml
ingress.networking.k8s.io/dashboard-ingress created

Хост указан как dashboard.com. Чтобы дашборд открывался по этому адресу необходимо прописать его в hosts. Так как у меня Windows, то адрес прописываю в C:\Windows\System32\drivers\etc\hosts.

Далее, в браузере заходим в дашборд по адресу http://dashboard.com



Все необходимые инструменты установлены.
+ +1 -

Добавить комментарий