Install Kubernetes in Docker (KinD)

From epsciwiki
Revision as of 03:51, 17 September 2024 by Tsai (talk | contribs) (→‎Usage)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Installing Kubernetes in Docker (KinD)

Prerequisites

  • Docker installed and running
  • kubectl installed (see below)

Installing kubectl

1. Download kubectl:

 curl -LO "https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl"
 

2. Make kubectl executable:

 chmod +x ./kubectl
 

3. Move kubectl to a directory in your PATH:

 sudo mv ./kubectl /usr/local/bin/kubectl
 

4. Verify installation:

 kubectl version --client
 

Installing KinD

1. Install KinD:

 curl -Lo ./kind https://kind.sigs.k8s.io/dl/v0.24.0/kind-linux-amd64
 chmod +x ./kind
 sudo mv ./kind /usr/local/bin/kind
 

2. Create a cluster:

 kind create cluster -n <cluster name>
 

3. Verify installation:

 kubectl cluster-info --context kind-kind
 

Usage

  • List clusters:
 kind get clusters
 
  • Delete cluster:
 kind delete cluster -n <cluster name>
 

See Also