Skip to content

Instantly share code, notes, and snippets.

@amoilanen
Last active May 7, 2023 16:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save amoilanen/b257df19611d8189899d6993b9c8f701 to your computer and use it in GitHub Desktop.
Save amoilanen/b257df19611d8189899d6993b9c8f701 to your computer and use it in GitHub Desktop.
Useful commands for creating a local Kubernetes cluster and running local images with Kubernetes using Kind

How to create a local Kubernetes cluster using Kind

kind create cluster --name k8s-playground --config kind-config.yaml
kind delete cluster --name k8s-playground

How to run local Docker images with Kind

Create image

docker build -t simple-node:0.0.1 .

Load Docker image

kind load docker-image simple-node:0.0.1 --name k8s-playground

Run the image

kubectl run simple-node --image=docker.io/library/simple-node:0.0.1

Create a deployment from the image in a namespace

kubectl create namespace development
kubectl create deployment simple-node --image=docker.io/library/simple-node:0.0.1 --namespace=development --replicas=3
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment