(Kubernetes aka k8s)
Kubernetes CLI
KubeCtl CLI doc
Kubernetes cheat sheet
K8s CLI Cheat sheet
CLI Quick ref
Docker Compose Kubernetes Cheat sheet
Kubernetes - Contexts
src: Docker: Kubernetes - intro - CLI example
kubectl config get-contexts
kubectl config use-context docker-desktop
kubectl get nodes
kubectl config view
Kubernetes - Orchestration example - running Pods:
src: Docker Kubernetes orchestration - short CLI reference
kubectl apply -f pod.yaml
kubectl get pods
kubectl logs demo
kubectl delete -f pod.yaml
Deploy to Kubernetes
(Containerize, Kubernetize, run)
Containerize
Containerize your application - Create image getting-started
git clone https://github.com/docker/getting-started.git
cd getting-started\app
copy con Dockerfile
# syntax=docker/dockerfile:1
FROM node:18-alpine
WORKDIR /app
COPY . .
RUN yarn install --production
CMD ["node", "src/index.js"]
EXPOSE 3000
^Z
docker build -t getting-started .
rem docker run -dp 3000:3000 getting-started
rem start http://localhost:3000
Kubernetize and run
src: Deploy to Kubernetes
Deploy, list, check, remote:
kubectl apply -f bb.yaml
kubectl get deployments
kubectl get services
start http://localhost:30001/
kubectl delete -f bb.yaml
Convert Docker Compose to Kubernetes
CLI kompose
Converts docker-compose.yaml to kubernetes-service.yaml
Kubernetes Dashboard
kubectl apply -f https://raw.githubusercontent.com/kubernetes/dashboard/v2.7.0/aio/deploy/recommended.yaml
kubectl proxy
kubectl delete -f https://raw.githubusercontent.com/kubernetes/dashboard/v2.7.0/aio/deploy/recommended.yaml
*
kubectl -n kubernetes-dashboard delete serviceaccount admin-user
kubectl -n kubernetes-dashboard delete clusterrolebinding admin-user
Kubernetes Dashboard - in Docker container (have not tested yet)
src: https://hub.docker.com/r/kubernetesui/dashboard
docker pull kubernetesui/dashboard
Namespaces
kubectl get namespaces
kubectl get namespaces --show-labels
kubectl create -f https://k8s.io/examples/admin/namespace-dev.json
Kubernetes config
src: StackOverflow
--kubeconfig
KUBECONFIG=$HOME/.kube/config
~/.kube/config # Linux
%USERPROFILE%/.kube # Windows
Kubernetes config file
kubectl -n kube-system create serviceaccount devops-cluster-admin
Kubernetes short tutorial
Docker and Kubernetes at TutorialPoint
See also
*
Docker: Get started with Kubernetes - build docker k8s ready apps
Kubernetes - home
*
Kubernetes: deprecating Docker, switch to other containers (containerd or CRI-O) (Open Container Initiative)
Kubernetes: Dockershim deprecation FAQ