K3d: K3s in docker
- related
- Install K3s K3s Lightweight Kubernetes
- link
- K3s in Docker containers How to run Kubernetes cluster locally using k3d
k3d cluster create spacebox -a 2
kubectl config get-contexts
kubectl config use-context k3d-spacebox
kubectl get nodes
kubectl get pods -n kube-system
kubectl top nodes --use-protocol-buffers
kubectl get ing
k3d kubeconfig get spacebox
see the port of where the k3d managed registry running
docker ps -f name=k3d-spacebox-registry
tag local docker image to a k3d managed registry
docker tag wayanjimmy/search:latest localhost:42029/testimage:local
push the docker image to the k3d managed registry
docker push localhost:42029/testimage:local
deployment.yaml
apiVersion: apps/v1
kind: Deployment
metadata:
name: wayanjimmy-search
labels:
app: wayanjimmy-search
spec:
selector:
matchLabels:
app: wayanjimmy-search
template:
metadata:
labels:
app: wayanjimmy-search
spec:
containers:
- name: wayanjimmy-search
image: k3d-spacebox-registry:42029/testimage:local
ports:
- containerPort: 80
livenessProbe:
httpGet:
path: /
port: 80
readinessProbe:
httpGet:
path: /
port: 80
resources:
limits:
cpu: 100m
memory: 256Mi
requests:
cpu: 80m
memory: 128Mi
ingress.yaml
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: wayanjimmy-search
annotations:
ingress.kubernetes.io/ssl-redirect: "false"
spec:
rules:
- http:
paths:
- path: /
pathType: Prefix
backend:
service:
name: wayanjimmy-search
port:
number: 80
service.yaml
apiVersion: v1
kind: Service
metadata:
name: wayanjimmy-search
labels:
app: wayanjimmy-search
spec:
type: ClusterIP
ports:
- port: 80
targetPort: 80
protocol: TCP
name: http
selector:
app: wayanjimmy-search