Skaffold
Execute Skaffold in dev mode
skaffold dev
Kubectl
- Build Docker image and Push
docker build -t bitxon/app-hz-client-server:latest .
docker push bitxon/app-hz-client-server:latest
- Deploy to Kubernetes
# Apply hazelcast RBAC
kubectl apply -f k8s/hazelcast-rbac.yaml
# Create hazelcast configmap
kubectl apply -f k8s/hazelcast-configmap.yaml
# Expose hazelcast(5701) for discovery
kubectl apply -f k8s/hazelcast-service.yaml
# Create hazelcast deployment
kubectl apply -f k8s/hazelcast-deployment.yaml
# Create application deployment
kubectl apply -f k8s/app-deployment.yaml
# Expose application(8080)
kubectl apply -f k8s/app-service.yaml
- Expose service port to local machine
kubectl port-forward service/application-service 8080:8080
Cleanup
kubectl delete -f k8s/app-service.yaml
kubectl delete -f k8s/app-deployment.yaml
kubectl delete -f k8s/hazelcast-deployment.yaml
kubectl delete -f k8s/hazelcast-service.yaml
kubectl delete -f k8s/hazelcast-configmap.yaml
kubectl delete -f k8s/hazelcast-rbac.yaml
# Put Value
curl --request PUT 'http://localhost:8080/cache/key1/valueA'
# Get Value
curl --request GET 'http://localhost:8080/cache/key1'
# Put Value to Locked cache (5 seconds long)
curl --request PUT 'http://localhost:8080/fenced-lock-cache/key1/valueB'
# Get Value from Locked cache (max wait 6 seconds)
curl --request GET 'http://localhost:8080/fenced-lock-cache/key1'
# Scale application
kubectl scale deployment application-deployment --replicas=5