Kubernetes: Porovnání verzí
Z Poznámkový blok
Řádka 1: | Řádka 1: | ||
== Instalace == | == Instalace == | ||
− | + | === K3S Server === | |
− | K3S | ||
sudo su - | sudo su - | ||
curl -sfL https://get.k3s.io | K3S_KUBECONFIG_MODE="644" sh - | curl -sfL https://get.k3s.io | K3S_KUBECONFIG_MODE="644" sh - | ||
− | K3S | + | '''K3S Server token:''' |
cat /var/lib/rancher/k3s/server/node-token | cat /var/lib/rancher/k3s/server/node-token | ||
− | K3S Agent | + | === K3S Agent === |
sudo su - | sudo su - | ||
− | curl -sfL https://get.k3s.io | K3S_URL=https://IP_K3S_SERVERU:6443 K3S_TOKEN= | + | 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 | + | * https://docs.k3s.io/installation/kube-dashboard |
− | kubectl apply -f https://raw.githubusercontent.com/kubernetes/dashboard/v2.7.0/aio/deploy/recommended.yaml | + | ==== Instalace ==== |
+ | sudo k3s kubectl apply -f https://raw.githubusercontent.com/kubernetes/dashboard/v2.7.0/aio/deploy/recommended.yaml | ||
− | Dashboard RBAC Configuration | + | ==== Konfigurace service účtu ==== |
+ | ===== Dashboard RBAC Configuration ===== | ||
''dashboard.admin-user.yml'' | ''dashboard.admin-user.yml'' | ||
apiVersion: v1 | apiVersion: v1 | ||
Řádka 42: | Řádka 44: | ||
name: admin-user | name: admin-user | ||
namespace: kubernetes-dashboard | namespace: kubernetes-dashboard | ||
− | + | ===== Uplatnění ===== | |
sudo k3s kubectl create -f dashboard.admin-user.yml -f dashboard.admin-user-role.yml | 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 | sudo k3s kubectl -n kubernetes-dashboard create token admin-user | ||
+ | ==== Smazání ==== | ||
sudo k3s kubectl delete ns kubernetes-dashboard | 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 == |
Verze z 29. 7. 2023, 11:24
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