Przejdź do treści

Podstawy Kubernetes – minikube

  • przez

Instalacja i zapoznanie się z podstawowymi poleceniami kubectl.

sudo apt-get install -y ca-certificates curl
curl -fsSL https://packages.cloud.google.com/apt/doc/apt-key.gpg | sudo gpg –dearmor -o /etc/apt/keyrings/kubernetes-archive-keyring.gpg
echo „deb [signed-by=/etc/apt/keyrings/kubernetes-archive-keyring.gpg] https://apt.kubernetes.io/ kubernetes-xenial main” | sudo tee /etc/apt/sources.list.d/kubernetes.list
sudo apt-get update
sudo apt-get install -y kubectl
kubectl cluster-info

apiVersion: v1

kind: Pod

metadata:
name: pod2

spec:
containers:
– name: ubuntu
image: ubuntu:18.04
command: [ „sleep”, „inf” ]
– name: nginx
image: nginx
ports:
– containerPort: 80

minikube start
kubectl get pods
minikube
minikube dashboard

mkdir minikube
touch pod.yml
kubectl create -f ./pod.yml
kubectl apply -f ./pod.yml
kubectl delete -f ./pod.yml
kubectl apply -f ./pod.yml
kubectl get pods
kubectl get pods -o wide
minikube ssh
kubectl delete -f ./pod.yml
kubectl apply -f ./ubuntu.yml
kubectl get pods -o wide
kubectl desciribe pod mojeubuntu
kubectl describe pod mojeubuntu
kubectl get pods -o wide
kubectl edit pod mojeubuntu
kubectl apply -f ./ubuntu.yml
kubectl delete -f ./ubuntu.yml
kubectl apply -f ./ubuntu.yml
kubectl exec mojeubuntu ps aux
kubectl exec mojeubuntu
kubectl exec mojeubuntu ps aux
kubectl exec -it mojeubuntu bash
kubectl get pods -o wide
kubectl delete -f ./ubuntu.yml
kubectl apply -f ./pod2.yml
kubectl get pods -o wide
kubectl logs pod2
kubectl logs pod2 nginx
kubectl logs pod2 ubuntu
kubectl logs pod2
kubectl exec -it pod2 bash
kubectl exec -c nginx -it pod2 bash
kubectl get pods -o wide
kubectl exec -it pod2 bash
kubectl delete -f ./pod2.yml
kubectl run nginx –image=nginx –dry-run=client -o yaml>nginx2.yml