Example of Monitoring pods on minishift with JMX.
Example application was developed in Spring Boot.
Minishift was used to test monitoring particular pods.
-
Install JAVA - we will need jconsole from java Java
-
Install
Docker
Docker CE INSTALLATION -
Download
minishift
Installing minishft
Minishift releases -
Set up virtualization environment for minishift
Setting Up the Virtualization Environment -
Download
oc tools
oc tools
- Build service:
docker build . -t jmx-example - Run minishift:
./minishift start --show-libmachine-logs -v5 - Configure minishift:
oc login -u system:admin
./oc adm policy add-cluster-role-to-user cluster-admin admin
./oc create is test-image-stream -n myproject - Do port forwarding:
oc login -u system:admin
oc project defaultoc get pods- check exact name of a pod withdocker-registryin name
oc port-forward docker-registry-1-zxsxx 8089:8089 - Login to minishift docker registry with token from minishift console:
- While starting minishift, there will be an url in logs to access minishift console
- Login with admin username and any password
- Click on right upper corner icon and chose
Copy Login Command - Login command has been placed in clipboard, paste it in any text editor and extract token part from it
docker login -u admin -p hp57zxkJ8jvxgtDMgDIXNDTCeBwlML_l_csut1eyYVk localhost:5000- use that token in docker login command
- Upload docker image:
docker tag jmx-example localhost:5000/myproject/jmx-example
docker push localhost:5000/myproject/jmx-example - Use uploaded docker image:
- Log in to minishift web console
- Choose
My Projectproject - Choose
Deploy Image - In
Image Stream Tagchoosemyprojectthentestandlatest(if nothing can be selected in third box, just click on it and press enter), then clickDeploy
- Configure environment variables:
- JAVA_OPTS:-Djava.rmi.server.hostname=localhost -Dcom.sun.management.jmxremote.port=8080 -Dcom.sun.management.jmxremote.rmi.port=8080 -Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.authenticate=false - Do port forwarding to the pod:
oc get pods- get pod name
oc port-forward test-4-zd42c 8080:8080- use pod name for port forwarding
- Openjconsole(from java directory)
- Typelocalhost:8080in remote address box
Completely reset minishift:
minishift delete --force --clear-cache
minishift stop
