Home > Mobile >  Error: endpoints "default-http-backend" not found
Error: endpoints "default-http-backend" not found

Time:10-08

I have Kubernetes cluster v1.19.16 set up in bare metal Ubuntu-18.04 server and currently i want to connect cluster jenkins service through http://jenkins.company.com. Haproxy server side frontend & backend already been configured.

My service.yaml file content as follows,

apiVersion: v1
kind: Service
metadata:
  name: jenkins-svc
  namespace: jenkins
  annotations:
      prometheus.io/scrape: 'true'
      prometheus.io/path:   /
      prometheus.io/port:   '8080'
spec:
  selector: 
    app: jenkins-server
  type: ClusterIP
  ports:
    - protocol: TCP
      port: 8080
      targetPort: 80

ingress-resource.yaml file content as follows,

apiVersion: networking.k8s.io/v1beta1
kind: Ingress
metadata:
  name: jenkins-ingress
  namespace: jenkins
  annotations:
    kubernetes.io/ingress.class: "nginx"
spec:
  rules:
  - host: "jenkins.company.com"
    http:
      paths:
      - pathType: Prefix
        path: "/"
        backend:
          serviceName: jenkins-svc
          servicePort: 8080
# kubectl get service -n jenkins
NAME          TYPE        CLUSTER-IP      EXTERNAL-IP   PORT(S)    AGE
jenkins-svc   ClusterIP   10.96.136.255   <none>        8080/TCP   20m
# kubectl get ing jenkins-ingress
Warning: extensions/v1beta1 Ingress is deprecated in v1.14 , unavailable in v1.22 ; use networking.k8s.io/v1 Ingress
NAME              CLASS    HOSTS                ADDRESS   PORTS   AGE
jenkins-ingress   <none>   jenkins.company.com            80      5h42m
# kubectl describe ingress  -n jenkins
Warning: extensions/v1beta1 Ingress is deprecated in v1.14 , unavailable in v1.22 ; use networking.k8s.io/v1 Ingress
Name:             jenkins-ingress
Namespace:        jenkins
Address:
Default backend:  default-http-backend:80 (<error: endpoints "default-http-backend" not found>)
Rules:
  Host             Path  Backends
  ----             ----  --------
  jenkins.dpi.com
                   /   jenkins-svc:8080 (10.244.0.16:80)
Annotations:       ingress.kubernetes.io/rewrite-target: /
                   kubernetes.io/ingress.class: nginx
Events:            <none>

When i tried to access http://jenkins.company.com it shows below error message on browser.

Error Message

Please let me know what i'm missing here?

CodePudding user response:

The issue with the service port and container port. Jenkins default port is 8080, so I assume your service port is 80

  ports:
    - protocol: TCP
      port: 80
      targetPort: 8080

and ingress should be

spec:
  rules:
  - host: "jenkins.company.com"
    http:
      paths:
      - pathType: Prefix
        path: "/"
        backend:
          serviceName: jenkins-svc
          servicePort: 80

port: The port of this service targetPort The target port on the pod(s) to forward traffic to

Difference between targetPort and port in Kubernetes Service definition

  • Related