I want to deploy Jenkins on a local Kubernetes cluster (no cloud).
I will create 2 services above Jenkins.
One service of type NodePort for port 8080
(be mapped on random port and I can access it outside the cluster. I can also access it inside the cluster by using ClusterIP:8080
). All fine.
My second service is so my Jenkins slaves can connect. I choose for a ClusterIP (default) as type of my service:
I read about the 3 types of services:
- clusterIP:
Exposes the service on a cluster-internal IP. Choosing this value makes the service only reachable from within the cluster.
- NodePort: is not necessary for 50000 to expose outside cluster
- Loadbalancer: I'm not working in the cloud
Here is my .yml
to create the services:
kind: Service
apiVersion: v1
metadata:
name: jenkins-ui
namespace: ci
spec:
type: NodePort
selector:
app: master
ports:
- protocol: TCP
port: 8080
targetPort: 8080
name: master
---
kind: Service
apiVersion: v1
metadata:
name: jenkins-discovery
namespace: ci
spec:
#type: ClusterIP
selector:
app: jenkins
ports:
- protocol: TCP
port: 50000
targetPort: 50000
name: slaves
The problem is that my slaves can not connect to port 50000.
I tried to telnet the ClusterIP:port
of the service jenkins-discovery and I got a connection refused. I can telnet to ClusterIP:port
of the jenkins-ui service. What am I doing wrong or is there a part I don't understand?
curl jenkins-discovery.default.svc.cluster.local
give you? – Michael Hausenblaskubectl get ep jenkins-ui -n ci
? Could it be a problem with yourselector
or a maybe areadinessProbe
you have on the Jenkins master? – Janos Lenartjenkins-ui 10.42.120.179:8080 1d
. For discovery it has Endpoints <none> where jenkins-UI has serviceIP:Port – lvthillo