Hazelcast prepared with discovery mechanism for Kubernetes
- Build project
mvn clean build
or
mvn clean istall
- Build and push docker image
mvn clean package docker:build -DpushImage -DpushImageTags -DdockerImageTags=<VERSION>
Pre-requisites:
* [minikube](https://github.com/kubernetes/minikube)
* Maven
* Java 8
- Run locally
./run.sh
- Deploy all
kubectl create -f devops
- Access local cluster
minikube dashboard
- Checking address of local service
minikube service k8s-java-sample --url
Service is prepared to be deployed in Kubernetes.
- Deploy all
kubectl create -f devops
- Access cluster
kubectl proxy
Then open dashboard in web-browser: http://localhost:8001/ui
- Make new deployment (after changing image version in
devops/deployment.yaml
)
kubectl apply -f devops/deployment.yaml
- Get pods
kubectl get pods
- Get services
kubectl get services
- Check logs of single pod
kubectl logs -f <pod_name>
If you have many containers in pod, name of container must be specified:
kubectl logs -f <pod_name> -c <container_name>
- Deleting stuff
kubectl delete service|deployment|pod <name>
- Rollout (provided that
revisionHistoryLimit
> 0 indevops/deployment.yaml
)
kubectl rollout undo deployment/<name>
- Scaling
kubectl scale --replicas=<number> deployment/<name>
- Get basic info about your services
watch -n 1 kubectl get configmap,secrets,deployments,services,ingress,nodes,pods