GoogleCloudPlatform/continuous-deployment-on-kubernetes

Issues when trying expose the service using Ingress

walteraa opened this issue · 1 comments

I am trying to expose my ui service using an ingress. I follow all the steps until exposing ingress, but no success.
When I try to access the Ingress public IP I am receiving a 404 error.

This is the way that my services are configured

NAME                TYPE        CLUSTER-IP     EXTERNAL-IP   PORT(S)          AGE
jenkins-discovery   ClusterIP   10.31.247.98   <none>        50000/TCP        23m
jenkins-ui          NodePort    10.31.248.40   <none>        8080:32344/TCP   23m

The jenkins-ui service description

Name:                     jenkins-ui
Namespace:                jenkins
Labels:                   <none>
Annotations:              <none>
Selector:                 app=master
Type:                     NodePort
IP:                       10.31.248.40
Port:                     ui  8080/TCP
TargetPort:               8080/TCP
NodePort:                 ui  32344/TCP
Endpoints:                10.28.0.9:8080
Session Affinity:         None
External Traffic Policy:  Cluster
Events:                   <none>

This is my ingress

NAME      HOSTS     ADDRESS          PORTS     AGE
jenkins   *         35.227.248.181   80, 443   20m

Ingress description

Name:             jenkins
Namespace:        jenkins
Address:          35.227.248.181
Default backend:  jenkins-ui:8080 (10.28.0.9:8080)
TLS:
  tls terminates
Rules:
  Host  Path  Backends
  ----  ----  --------
  *     *     jenkins-ui:8080 (10.28.0.9:8080)
Annotations:
  backends:         {"k8s-be-32344--45cab719cf50437a":"Unknown"}
  forwarding-rule:  k8s-fw-jenkins-jenkins--45cab719cf50437a
  target-proxy:     k8s-tp-jenkins-jenkins--45cab719cf50437a
  url-map:          k8s-um-jenkins-jenkins--45cab719cf50437a
Events:
  Type    Reason   Age              From                     Message
  ----    ------   ----             ----                     -------
  Normal  ADD      3m               loadbalancer-controller  jenkins/jenkins
  Normal  CREATE   2m               loadbalancer-controller  ip: 35.227.248.181
  Normal  Service  2m (x4 over 2m)  loadbalancer-controller  default backend set to jenkins-ui:32344

When I change my jenkins-ui service type to LoadBalancer, it works.

Additional informations:

$ kubectl version
Client Version: version.Info{Major:"1", Minor:"9", GitVersion:"v1.9.1", GitCommit:"3a1c9449a956b6026f075fa3134ff92f7d55f812", GitTreeState:"clean", BuildDate:"2018-01-04T19:59:01Z", GoVersion:"go1.9.2", Compiler:"gc", Platform:"darwin/amd64"}
Server Version: version.Info{Major:"1", Minor:"7+", GitVersion:"v1.7.11-gke.1", GitCommit:"3500f53730c1fea7b57901977df165c3eb317bce", GitTreeState:"clean", BuildDate:"2017-12-08T18:05:07Z", GoVersion:"go1.8.3", Compiler:"gc", Platform:"linux/amd64"}

Am I doing something wrong?

We are now using the upstream Helm Chart which includes options for exposing via ingress:

https://github.com/helm/charts/blob/master/stable/jenkins/values.yaml#L119