Getting started
- Kubernetes: the whole orchestration system (K8s "k-eights" or Kube for short)
- Kubectl: CLI to configure Kubernetes and manage apps (using "cube control" official pronunciation)
- Node: single server in the Kubernetes cluster
- Kubelet: Kubernetes agent running on nodes
- Control plane: set of containers that manage the cluster
- Includes API server, scheduler, controller manager, etcd and more
- Sometimes called the "master"
- Kubernetes is a series of containers, CLI's and configurations
- Many ways to install:
- MacOS: Docker Desktop - Enable in Settings. Sets up everything inside Docker's existing Linux VM
- Runs, configures Kubernetes Master containers
- Manages
kubectl
install and certificates - Easily install, disable and remove from Docker GUI
- Docker Toolbox on Windows - MiniKube. Uses VirtualBox to make Linux VM
- Doesn't install
kubectl
, has to be installed separately
- Your own Linux host or VM - MicroK8s. Installs Kubernetes right on the OS
- Uses snap (rather apt or yum) for install.
- Control MicroK8s service via
microk8s.
commands kubectl
accessible viamicrok8s.kubectl
- Add an alias to your shell (.bash_profile):
alias kubectl=microk8s.kubectl
- Kuberneters in a Browser
- katacoda.com
- Pod: one or more containers running together on one node. Basic unit of deployment. Containers are always in pods.
- Controller: for creating / updating pods and other objects. Controllers manage pods, you almost never manage pods yourself. There are many types of Controllers, including
Deployment
,ReplicaSet
,StatefulSet
,DaemonSet
,Job
,CronJob
, etc. - Service: network endpoint to connect to a pod.
- Namespace: Filtered group of objects in cluster.
- Secrets, ConfigMaps, etc.
- Kubernetes is evolving, and so is the CLI
- We get 3 ways to create pods from the kubectl CLI
kubectl run
(changing to be only for pod creation)kubectl create
(create some resources via CLI or YAML)kubectl apply
(create / update anything via YAML)
kubectl version
- shows a version of Client and Serverkubectl cluster-info
kubectl run my-nginx --image nginx
- this will create a pod, replica set and a deploymentkubectl get pods
- get current podskubectl get all
- get all componentskubectl delete deployment my-nginx
- delete named deployment
- Start new deployment for one replica/pod
kubectl run my-apache --image httpd
- Scale deployment
kubectl scale deploy/my-apache --replicas 2
kubectl scale deployment my-apache --replicas 2
(these are same commands)
- Get logs
kubectl logs deployment my-apache
- Get logs from pods with a given label
kubectl logs -l run=my-apache
brew install stern
stern pod-query
- Get pod info
kubectl describe pod/<pod-id>
(pod-id can be obtained with kubectl get pods)`
Last modified 3yr ago