Accessing kubernetes pod end point from jenkins

11/30/2018

I am facing with the following query.

My Jenkins is outside the kubernetes cluster in a separate network as it is a common build tool for building application and infrastructure. I am deploying a containerised application in kubernetes ( which is in a completely different network than Jenkins) as a pod. My application is a spring boot application and has actuator enabled to check the overall health of the container.

I do not want to expose any load balancer IPs or DNS to the public for individual services to refer to the pods, yet, I want to be able query the actuator in spring boot to check whether health is UP.

Is it possible that:

1) I use the kubernetes CRD for this purpose. If yes, what is the approach 2) A recommendation exists for this use case.

Thanks

-- sibh8
docker
kubernetes
microservices
spring-boot

1 Answer

11/30/2018
  1. Use Kubernetes Liveness and Readiness Probe to check if the service is up , so this can be done as part of Kubernetes itself
  2. Configure Kubectl to run remotely from your Jenkins server ( you can put restrictions to not allow any other IPs outside the network , also if you dont provide any external or load balancer ips/ingress to kubernetes , pod services will be not exposed outside ). Use kubectl commands to check if your pod is up ( which in turn will use liveness probe ) , you can write a simple shell script which will keep checking in loop with a timeout for your POD to get Ready. You should be able to find some examples of this in kubectl cheat sheet
-- fatcook
Source: StackOverflow