Install K3d via k3d-installers
# See K3d version after installation
k3d version
Create a local (cluster-name) as dev-cluster
with 1 master server and 2 worker agents with expose ports 80 (http) and 443 (https) for the load balancer within the k3d cluster
k3d cluster create dev-cluster -p "80:80@loadbalancer" -p "443:443@loadbalancer" --servers 1 --agents 2
- Import the image into your cluster (e.g.,
dev-cluster
)
k3d --cluster <cluster-name> image import <image-name>:<image-tag>
e.g.,
k3d --cluster dev-cluster image import <image-name>:<image-tag>
# OR
k3d -c dev-cluster image import <image-name>:<image-tag>
OR
k3d --cluster <cluster-name> images import <image-name-1>:<image-tag-1> <image-name-2>:<image-tag-2>
e.g.,
k3d --cluster dev-cluster images import <image-name-1>:<image-tag-1> <image-name-2>:<image-tag-2>
# OR
k3d -c dev-cluster images import <image-name-1>:<image-tag-1> <image-name-2>:<image-tag-2>
docker exec k3d-<cluster-name>-server-<number> crictl images
# OR
docker exec k3d-<cluster-name>-agent-<number> crictl images
e.g., To see images present in K3d: dev-cluster
docker exec k3d-dev-cluster-server-0 crictl images
NOTE: If using image-tag as:latest
then please set imagePullPolicy: Never
in the manifests yaml files, It's a K3d issue
k3d cluster list
# OR
k3d cluster ls
k3d cluster stop dev-cluster
k3d cluster start dev-cluster
k3d cluster delete dev-cluster
k3d node list
kubectl cluster-info
# OR
kubectl cluster-info dump
# Display the cluster events
k get events
# Display the cluster config
k config view
# Display list of contexts
k config get-contexts
# Display the current-context
k config current-context
# Set the default context to k3d <cluster-name>
k config use-context dev-cluster
# List all nodes in all namespaces
k get nodes -A
# List all services in all namespaces
k get services -A
k get svc -A
# List all deployments in all namespaces
k get deploy -A
# List all pods in all namespaces
k get pods -A
# List all configmaps in all namespaces
k get configmaps -A
# List all secrets in all namespaces
k get secrets -A
# Watch all pods
k get pods -w -o wide
# Watch all deployments
k get deploy -w -o wide
# Watch all services
k get svc -w -o wide
# Watch all configmaps
k get configmaps -w -o wide
# Create kubectl resources
k apply -f <yaml-file-path>
# Delete kubectl resources
k delete -f <yaml-file-path>
# Delete kubectl specific resources
k delete -f <deploymnet-service-file.yaml>
k delete -f <config-maps-file.yaml>