a cli tool for managing and testing kubernetes microservices locally using minikube
launch, manage, and monitor a small ecosystem running on a cluster. it provides functionality for deployment, scaling, and status checking of services, along with features for testing service mesh configurations like traffic routing and load balancing.
- service deployment: easily deploy microservices with
kubecore deploy service-name
- scaling: adjust the number of replicas with
kubecore scale service-name --replicas=3
- status monitoring: check service status, pods, and metrics with
kubecore status
- ingress management: create and manage ingress rules for your services
- canary deployments: test new versions of your services with traffic splitting
- go 1.21 or higher
- minikube
- kubectl
- docker
- apache benchmark (ab) for load testing
- build the project:
go build -o kubecore
- start minikube:
minikube start --cpus=2 --memory=4096mb --driver=docker
- enable ingress:
minikube addons enable ingress
- deploy a service:
./kubecore deploy myservice
- scale the service:
./kubecore scale myservice --replicas=3
- check status:
./kubecore status
# deploy two services
./kubecore deploy service1
./kubecore deploy service2
# verify deployment
./kubecore status
# create ingress rules
kubectl apply -f - <<EOF
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: service1-ingress
annotations:
nginx.ingress.kubernetes.io/rewrite-target: /
spec:
ingressClassName: nginx
rules:
- host: app1.test
http:
paths:
- path: /app1
pathType: Prefix
backend:
service:
name: service1
port:
number: 80
EOF
# add to /etc/hosts
echo "$(minikube_ip) app1.test" | sudo tee -a /etc/hosts
# test the endpoint
curl -H "Host: app1.test" http://app1.test/app1
# deploy v1
./kubecore deploy service1-v1
# deploy v2 with traffic splitting
kubectl apply -f canary.yaml
# test traffic distribution
./advanced-load-test.sh
# install apache benchmark if not installed
sudo apt-get install apache2-utils
# run load test
ab -n 1000 -c 50 -H "Host: app1.test" http://(MINIKUBE_IP)/app1/
# ingress controller logs
kubectl logs -n ingress-nginx -l app.kubernetes.io/component=controller -f
# service logs
kubectl logs -l app=service1
# enable metrics server
minikube addons enable metrics-server
# view pod metrics
kubectl top pods
- traffic test:
./scripts/traffic-test.sh
- canary deployment test:
./scripts/canary-test.sh
- advanced load test:
./scripts/advanced-load-test.sh
- ingress test:
./scripts/ingress-test.sh
- ingress not working:
# verify ingress controller is running
kubectl get pods -n ingress-nginx
# check ingress configuration
kubectl describe ingress service1-ingress
- service not responding:
# check pod status
kubectl get pods -l app=service1
# check service endpoints
kubectl describe service service1
- performance issues:
# check resource usage
kubectl top pods
kubectl top nodes