Kubernetes: различия между версиями
Перейти к навигации
Перейти к поиску
Artem (обсуждение | вклад) |
Artem (обсуждение | вклад) |
||
Строка 73: | Строка 73: | ||
<pre> | <pre> | ||
sudo systemctl start docker | |||
sudo swapoff -a | |||
sudo mv /etc/containerd/config.toml /etc/containerd/config222.toml | |||
sudo kubeadm reset --force | sudo kubeadm reset --force | ||
sudo kubeadm init --pod-network-cidr=10.244.0.0/16 | sudo kubeadm init --pod-network-cidr=10.244.0.0/16 |
Текущая версия от 22:36, 6 ноября 2024
Installation
sudo apt-get update sudo apt-get install -y apt-transport-https ca-certificates curl sudo mkdir -p /etc/apt/keyrings sudo curl -fsSL https://pkgs.k8s.io/core:/stable:/v1.30/deb/Release.key | sudo gpg --dearmor -o /etc/apt/keyrings/kubernetes-apt-keyring.gpg sudo echo 'deb [signed-by=/etc/apt/keyrings/kubernetes-apt-keyring.gpg] https://pkgs.k8s.io/core:/stable:/v1.30/deb/ /' | sudo tee /etc/apt/sources.list.d/kubernetes.list sudo apt-get update sudo apt-get install -y kubelet kubeadm kubectl sudo apt-mark hold kubelet kubeadm kubectl
Шпаргалка по командам
- Kubernetes Crash Course for Absolute Beginners NEW
- Шпаргалка по kubectl
- Docker Containers and Kubernetes Fundamentals – Full Hands-On Course
minikube start --mount-string="$HOME/go/src/github.com/nginx:/data" --mount --driver=docker minikube ip kubectl cluster-info kubectl create deployment nginx-depl --image=nginx kubectl get pod kubectl get replicaset kubectl get pod <POD-ID> -o wide kubectl get deployment nginx-depl kubectl get deployment nginx-depl -o yaml kubectl edit deployment nginx-depl kubectl logs <POD-ID> kubectl describe pod <POD-ID> kubectl exec -it <POD-ID> -- /bin/bash kubectl apply -f <CONFIG.YML> kubectl get deployment nginx-deployment -o yaml # https://kubernetes.github.io/ingress-nginx/troubleshooting/ kubectl get ingress -n mongo-admin kubectl describe ing mongo-express-ingress -n mongo-admin kubectl describe ingress mongo-express-ingress -n mongo-admin kubectl rollout restart deployment <deployment_name> -n <namespace> kubectl delete --all pods --namespace=kubernetes-dashboard
System reset
minikube stop minikube delete rm -rf ~/.minikube rm -rf ~/.kube docker kill $(docker ps -q) docker rm $(docker ps -a -q) docker rmi $(docker images -q) docker system prune
Setup cluster
sudo su swapoff -a kubeadm reset kubeadm init mkdir -p $HOME/.kube sudo cp -i /etc/kubernetes/admin.conf $HOME/.kube/config sudo chown $(id -u):$(id -g) $HOME/.kube/config
sudo systemctl start docker sudo swapoff -a sudo mv /etc/containerd/config.toml /etc/containerd/config222.toml sudo kubeadm reset --force sudo kubeadm init --pod-network-cidr=10.244.0.0/16 /run/flannel/subnet.env FLANNEL_NETWORK=10.244.0.0/16 FLANNEL_SUBNET=10.244.0.1/24 FLANNEL_MTU=1450 FLANNEL_IPMASQ=true kubectl apply -f https://github.com/flannel-io/flannel/releases/latest/download/kube-flannel.yml kubectl taint nodes --all node-role.kubernetes.io/control-plane- kubectl taint nodes --all node.kubernetes.io/disk-pressure- kubectl taint nodes --all node.kubernetes.io/not-ready-
Translate a Docker Compose File to Kubernetes Resources
Helm
https://helm.sh/docs/intro/install/
Clear space / Remove unused images
crictl rmi --prune docker image prune -a