Install on macOS with Docker Desktop

1. Docker Desktop (DD) -> Preferencies -> Kubernetes
2. Enable Kubernetes
3. Apply & Restart
4. launch kubectl version from terminal

kubectl

$ kubectl version
$ kubectl get nodes
$ kubectl services
$ kubectl get services
$ kubectl create -h

$ kubectl create deployment NAME --image=IMAGE
Es:
$ kubectl create deployment kube-nginx --image=nginx
$ kubectl get deployment
$ kubectl get pod
$ kubectl get replicaset
$ kubectl edit deployment kube-nginx
$ kubectl create deployment kube-mongo --image=mongo
$ kubectl describe pod <pod name> (<pod name> ottenuto con kubectl get pod)
$ kubectl logs <pod name> (come sopra)
$ kubectl exec -it <pod name> -- bin/bash
$ kubectl delete deployment <depo name> (<depo name> ottenuto con kubectl get deployment)
$ kubectl apply -f <config.yml>
$ kubectl get service
$ kubectl describe service <service name> (ottenuto dal cmd sopra)
$ kubectl get pod -o wide (per avere più info)
Es:
$ kubectl get deployment nginx-deployment -o yaml
$ kubectl get deployment nginx-deployment -o yaml > nginx-deployment-result.yml
$ kubectl delete -f nginx-deployment.yml
$ kubectl delete -f nginx-service.yml
Encoding username/password for secret:
$ echo -n 'username' | base64

Mongo + Mongo Express

$ kubectl get all
$ kubectl apply -f mongo-secret.yml
$ kubectl get secret
$ kubectl apply -f mongo-deployment.yml
$ kubectl apply -f mongo-express-deployment.yml

Kubernetes in local the easy way: Docker Desktop (on Mac)

https://medium.com/backbase/kubernetes-in-local-the-easy-way-f8ef2b98be68

$ kubectl run nginx --image=nginx --port=80 --restart=Never
$ kubectl get pods
$ kubectl describe pod nginx
$ kubectl expose pod nginx --type=NodePort
$ kubectl get svc
$ kubectl describe service nginx
$ kubectl get service nginx -o yaml > nginx-service-result.yml

NB In Docker-desktop you can reach the app through the port on the left, es:

NAME      TYPE            CLUSTER-IP       EXTERNAL-IP    PORT
web       LoadBalancer    10.105.194.57                   8081:32218/TCP 

Namespaces (1:46:23)

$ kubectl get namespace
$ kubectl cluster-info
$ kubectl create namespace my-namespace
$ kubectl apply -f mongo-deployment.yml --namespace=my-namespace

Or under metadata section you can add
namespace: my-namespace key pair

Kubectx / Kubens (2:00:00)
Ingress (2:02:00)

….

HELM (2:24:20)

VOLUMES (2:38:00)


0 commenti

Lascia un commento

Segnaposto per l'avatar