Kubernetes

Z Poznámkový blok
Přejít na: navigace, hledání

Instalace

K3S Server

sudo su -
curl -sfL https://get.k3s.io | K3S_KUBECONFIG_MODE="644" sh -

K3S Server token:

cat /var/lib/rancher/k3s/server/node-token

K3S Agent

sudo su -
curl -sfL https://get.k3s.io | K3S_URL=https://IP_K3S_SERVERU:6443 K3S_TOKEN=K3S_SERVER_TOKEN sh -

IP_K3S_SERVERU odkazuje na k3s serveru kde se musí taky vzít K3S_SERVER_TOKEN

Kubernetes proxy

Dobré pro testování, nikoliv pro produkci

kubectl proxy --disable-filter=true --address 0.0.0.0

Dashboards

Kubernetes dashboard

Instalace

sudo k3s kubectl apply -f https://raw.githubusercontent.com/kubernetes/dashboard/v2.7.0/aio/deploy/recommended.yaml

Konfigurace service účtu

Dashboard RBAC Configuration

dashboard.admin-user.yml

apiVersion: v1
kind: ServiceAccount
metadata:
  name: admin-user
  namespace: kubernetes-dashboard

dashboard.admin-user-role.yml

apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
  name: admin-user
roleRef:
  apiGroup: rbac.authorization.k8s.io
  kind: ClusterRole
  name: cluster-admin
subjects:
- kind: ServiceAccount
  name: admin-user
  namespace: kubernetes-dashboard
Uplatnění
sudo k3s kubectl create -f dashboard.admin-user.yml -f dashboard.admin-user-role.yml
Získání Beart tokenu
sudo k3s kubectl -n kubernetes-dashboard create token admin-user

Smazání

sudo k3s kubectl delete ns kubernetes-dashboard

Upgrade

 sudo k3s kubectl delete ns kubernetes-dashboard
 sudo k3s kubectl apply -f https://raw.githubusercontent.com/kubernetes/dashboard/VERZE/aio/deploy/recommended.yaml

VERZE viz. https://github.com/kubernetes/dashboard

URL API přes proxy

http://IP_ADDRESS:8001/api/v1/namespaces/kubernetes-dashboard/services/https:kubernetes-dashboard:/proxy/.

Portainer

Instalace

sudo k3s kubectl apply -n portainer -f https://raw.githubusercontent.com/portainer/k8s/master/deploy/manifests/portainer/portainer.yaml

Smazání

sudo k3s kubectl delete ns portainer

Upgrade

sudo k3s kubectl delete ns portainer
sudo k3s kubectl apply -n portainer -f https://raw.githubusercontent.com/portainer/k8s/master/deploy/manifests/portainer/portainer.yaml

Konfigurace