Kubernetes
Kubernetes In Docker [KInD]
graph LR
image([image]) --> |used by|container
subgraph pod
direction TB
container
end
graph LR
subgraph deployment
direction TB
subgraph pod
container
end
end
Create a Cluster and look around
-
Get started
kind create cluster
output
Creating cluster "kind" ... ā Ensuring node image (kindest/node:v1.25.0) š¼ ā Preparing nodes š¦ ā Writing configuration š ā Starting control-plane š¹ļø ā Installing CNI š ā Installing StorageClass š¾ Set kubectl context to "kind-kind" You can now use your cluster with: kubectl cluster-info --context kind-kind Have a nice day! š
-
standard
kubectl
commands```text kubectl cluster-info --context kind-kind
output
Kubernetes control plane is running at https://127.0.0.1:56236 CoreDNS is running at https://127.0.0.1:56236/api/v1/namespaces/kube-system/services/kube-dns:dns/proxy To further debug and diagnose cluster problems, use 'kubectl cluster-info dump'.
And taking a look at the context
kubectl config current-context
output
kind-kind
Create our first resource
-
Running things directly
!!WARN: This is not the recommended way to run things in Kubernetes!!
kubectl run --image gcr.io/google-containers/busybox mypod
output
pod/mypod created
-
Inspect the pod
kubectl get pod
output
NAME READY STATUS RESTARTS AGE mypod 0/1 CrashLoopBackOff 1 (12s ago) 16s
-
Look at "all" the things
kubectl get all
output
NAME READY STATUS RESTARTS AGE pod/mypod 0/1 CrashLoopBackOff 1 (3s ago) 7s NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE service/kubernetes ClusterIP 10.96.0.1 <none> 443/TCP 13m
From Misc
Go to text ā
Alternative ā Windows Hyper-V
A Hyper-what-now?
Big words! It's a piece like VMWare, VirtualBox, Hyper-V ā which is built into Windows
Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Hyper-V -All
output
Path :
Online : True
RestartNeeded : False
Install kind
Alternative ā Install minikube
-
Follow the instructions in minikube start
-
Download
minikube.exe
New-Item -Path 'c:\' -Name 'minikube' -ItemType Directory -Force Invoke-WebRequest -OutFile 'c:\minikube\minikube.exe' -Uri 'https://github.com/kubernetes/minikube/releases/latest/download/minikube-windows-amd64.exe' -UseBasicParsing
-
Add the executable to your path
$oldPath = [Environment]::GetEnvironmentVariable('Path', [EnvironmentVariableTarget]::User) if ($oldPath.Split(';') -inotcontains 'C:\minikube'){ ` [Environment]::SetEnvironmentVariable('Path', $('C:\minikube;{0}' -f $oldPath), [EnvironmentVariableTarget]::User) ` }
-
Reload your path. The easiest way is to stop and start your terminal again.
If you use VS Code do not use Developer: Reload Window. You will need to close and open the full application.
The same applies other tools like JetBrains products if you use them.
Get-Command minikube
Output
CommandType Name Version Source ----------- ---- ------- ------ Application minikube.exe 0.0.0.0 C:\minikube\minikube.exe
Children