Kubernetes

Kubernetes In Docker (KInD)

Todo

FIXME: enable mermaid

graph LR
  image([image]) --> |used by|container
  subgraph pod
    direction TB
    container
  end

Todo

FIXME: enable mermaid

graph LR

  subgraph deployment
    direction TB

    subgraph pod
      container
    end

  end

We can easily create a cluster using Kubernetes - Create KiND Cluster.

To create simple (trivial) resources you can use kubectl directly. For a complete example look at Kubernetes - Create a Simple Resource.

Alternative — Install minikube

  • Follow the instructions in minikube start

  • Download minikube.exe

    1New-Item -Path 'c:\' -Name 'minikube' -ItemType Directory -Force
    2Invoke-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

    1$oldPath = [Environment]::GetEnvironmentVariable('Path', [EnvironmentVariableTarget]::User)
    2if ($oldPath.Split(';') -inotcontains 'C:\minikube'){ `
    3  [Environment]::SetEnvironmentVariable('Path', $('C:\minikube;{0}' -f $oldPath), [EnvironmentVariableTarget]::User) `
    4}
    
  • 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.

    VS Code Reload Window Command

    The same applies to other tools like JetBrains products if you use them.

    1Get-Command minikube
    

    Output:

    1CommandType     Name                                               Version    Source
    2-----------     ----                                               -------    ------
    3Application     minikube.exe                                       0.0.0.0    C:\minikube\minikube.exe
    

Kubernetes CPU limits

Kubernetes CPU Limits

How to start a Pod

1kubectl run nginx --image=nginx

How to delete a Pod

1kubectl delete pod nginx

How to get a Pod

1kubectl get pod nginx