deployment, service, ingress implemented. Got default backend - 404GCE ingress with routes always falls back to default-http-backendKubernetes nginx ingress controller service (version 0.9.0) refusing connectionsGKE with Ingress setup always gives status UNHEALTHYIngress backend rule by port?Deleting path from kubernetes ingress with java kubernetes-clientIngress resource does not give access to exposed servicesKubernetes nginx ingress is not resolving servicesRedirection from http to https not working for custom backend service in Kubernetes Nginx Ingress ControllerKubernetes NGINX ingress only ever returning default back end, not any of the other ingress rules set upNginx reverse proxy in front of a Kubernetes Ingress

Is TA-ing worth the opportunity cost?

Generate Brainfuck for the numbers 1–255

Are there any financial disadvantages to living significantly "below your means"?

Opposite for desideratum to mean "something not wished for"

If "more guns less crime", how do gun advocates explain that the EU has less crime than the US?

How to change a file name containing ":" in timing info

Can you castle with a "ghost" rook?

What is my malfunctioning AI harvesting from humans?

Was the 2019 Lion King film made through motion capture?

Why is transplanting a specific intact brain impossible if it is generally possible?

Who are these characters/superheroes in the posters from Chris's room in Family Guy?

What should I call bands of armed men in Medieval Times?

Why did Gandalf use a sword against the Balrog?

In a topological space if there exists a loop that cannot be contracted to a point does there exist a simple loop that cannot be contracted also?

Different inverter (logic gate) symbols

What is the difference between 型 and 形?

Should I ask for permission to write an expository post about someone's else research?

Multirow in tabularx?

Identification of vintage sloping window

AsyncDictionary - Can you break thread safety?

Dropdowns & Chevrons for Right to Left languages

Why are Gatwick's runways too close together?

What are the uses and limitations of Persuasion, Insight, and Deception against other PCs?

Am I overreacting to my team leader's unethical requests?



deployment, service, ingress implemented. Got default backend - 404


GCE ingress with routes always falls back to default-http-backendKubernetes nginx ingress controller service (version 0.9.0) refusing connectionsGKE with Ingress setup always gives status UNHEALTHYIngress backend rule by port?Deleting path from kubernetes ingress with java kubernetes-clientIngress resource does not give access to exposed servicesKubernetes nginx ingress is not resolving servicesRedirection from http to https not working for custom backend service in Kubernetes Nginx Ingress ControllerKubernetes NGINX ingress only ever returning default back end, not any of the other ingress rules set upNginx reverse proxy in front of a Kubernetes Ingress






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;








1















I am practicing k8s deployment, service, and ingress implementation from here on GKE. Clicking through the simulator help me quickly understand concept, but when I do hands on. I stuck default backend - 404. Here are my manifest files and bash description.



deployment.yaml



apiVersion: apps/v1beta2
kind: Deployment
metadata:
name: tunnel-deployment
labels:
app: tunnel
spec:
replicas: 1
selector:
matchLabels:
app: tunnel
template:
metadata:
labels:
app: tunnel
spec:
containers:
- name: tunnel
image: gcr.io/k8s-v1-235608/tunnel:latest
imagePullPolicy: Always
ports:
- containerPort: 8080
env:
- name: MONGODB_HOST
value: moon-mongodb-replicaset-client
- name: RABBIT_HOST
value: rodent-rabbitmq-headless
- name: RABBIT_PASSWORD
valueFrom:
secretKeyRef:
name: rodent-rabbitmq
key: rabbitmq-password
- name: REDIS_HOST
value: ninja-redis-ha
readinessProbe:
tcpSocket:
port: 8080
initialDelaySeconds: 5
periodSeconds: 10
livenessProbe:
tcpSocket:
port: 8080
initialDelaySeconds: 15
periodSeconds: 20


See deployments in bash



$ kubectl get deployments -o wide
NAME DESIRED CURRENT UP-TO-DATE AVAILABLE AGE CONTAINERS IMAGES SELECTOR
tunnel-deployment 1 1 1 1 11m tunnel gcr.io/k8s-v1-235608/tunnel:latest app=tunnel


See po in bash



$ kubectl get po -o wide
NAME READY STATUS RESTARTS AGE IP NODE NOMINATED NODE
bbox 1/1 Running 0 1d 10.4.0.6 gke-doom-default-pool-4b763b09-pxnz <none>
moon-mongodb-replicaset-0 1/1 Running 0 1d 10.4.2.9 gke-doom-default-pool-4b763b09-lcs6 <none>
moon-mongodb-replicaset-1 1/1 Running 0 1d 10.4.0.8 gke-doom-default-pool-4b763b09-pxnz <none>
moon-mongodb-replicaset-2 1/1 Running 0 1d 10.4.2.10 gke-doom-default-pool-4b763b09-lcs6 <none>
ninja-redis-ha-server-0 2/2 Running 0 1d 10.4.0.9 gke-doom-default-pool-4b763b09-pxnz <none>
ninja-redis-ha-server-1 2/2 Running 0 1d 10.4.1.11 gke-doom-default-pool-4b763b09-85ch <none>
ninja-redis-ha-server-2 2/2 Running 0 1d 10.4.2.11 gke-doom-default-pool-4b763b09-lcs6 <none>
rodent-rabbitmq-0 1/1 Running 0 1d 10.4.2.12 gke-doom-default-pool-4b763b09-lcs6 <none>
tunnel-deployment-fddf78dcc-lpq8l 1/1 Running 0 11m 10.4.1.37 gke-doom-default-pool-4b763b09-85ch <none>


service.yaml. I use NodePort with my tunnel-service.
With my selection.app



apiVersion: v1
kind: Service
metadata:
name: tunnel-service
labels:
app: tunnel
spec:
type: NodePort
ports:
- name: tunnel-port
port: 80
targetPort: 8080
selector:
app: tunnel


Then I have single IP address to represent my service.



$ kubectl describe svc tunnel-service
Name: tunnel-service
Namespace: default
Labels: app=tunnel
Annotations: kubectl.kubernetes.io/last-applied-configuration:
{"apiVersion":"v1","kind":"Service","metadata":"annotations":,"labels":"app":"tunnel","name":"tunnel-service","namespace":"default",...
Selector: app=tunnel
Type: NodePort
IP: 10.7.242.110
Port: tunnel-port 80/TCP
TargetPort: 8080/TCP
NodePort: tunnel-port 32713/TCP
Endpoints: 10.4.1.37:8080
Session Affinity: None
External Traffic Policy: Cluster
Events: <none>


ingress.yaml. I route the / to my tunnel-service



apiVersion: extensions/v1beta1
kind: Ingress
metadata:
name: tunnel-ingress
spec:
rules:
- host: abc.hbot.io
http:
paths:
- path: /
backend:
serviceName: tunnel-service
servicePort: 80


$ kubectl describe ingress
Name: tunnel-ingress
Namespace: default
Address: 35.244.186.216
Default backend: default-http-backend:80 (10.4.1.9:8080)
Rules:
Host Path Backends
---- ---- --------
abc.hbot.io
/ tunnel-service:80 (<none>)
Annotations:
ingress.kubernetes.io/backends: "k8s-be-31768--d2232907436d0807":"HEALTHY","k8s-be-32713--d2232907436d0807":"UNHEALTHY"
ingress.kubernetes.io/forwarding-rule: k8s-fw-default-tunnel-ingress--d2232907436d0807
ingress.kubernetes.io/target-proxy: k8s-tp-default-tunnel-ingress--d2232907436d0807
ingress.kubernetes.io/url-map: k8s-um-default-tunnel-ingress--d2232907436d0807
kubectl.kubernetes.io/last-applied-configuration: "apiVersion":"extensions/v1beta1","kind":"Ingress","metadata":"annotations":,"name":"tunnel-ingress","namespace":"default","spec":"rules":["host":"abc.hbot.io","http":"paths":["backend":"serviceName":"tunnel-service","servicePort":80,"path":"/"]]

Events:
Type Reason Age From Message
---- ------ ---- ---- -------
Normal ADD 16m loadbalancer-controller default/tunnel-ingress
Normal CREATE 15m loadbalancer-controller ip: 35.244.186.216


In my browser. I had routed my hostname to my correct DNS and got default backend - 404



I confirm my pod in deployment works. My endpoint does response on my request.



bash-4.3# curl http://localhost:8080/api
Hi I'm API Interface


Update on Attempt #1:

Add * after / and apply



$ kubectl apply -f ingress.yaml
ingress.extensions/tunnel-ingress configured

$ kubectl describe ingress
Name: tunnel-ingress
Namespace: default
Address: 35.244.186.216
Default backend: default-http-backend:80 (10.4.1.9:8080)
Rules:
Host Path Backends
---- ---- --------
abc.hbot.io
/* tunnel-service:80 (<none>)
Annotations:
ingress.kubernetes.io/backends: "k8s-be-31768--d2232907436d0807":"HEALTHY","k8s-be-32713--d2232907436d0807":"UNHEALTHY"
ingress.kubernetes.io/forwarding-rule: k8s-fw-default-tunnel-ingress--d2232907436d0807
ingress.kubernetes.io/target-proxy: k8s-tp-default-tunnel-ingress--d2232907436d0807
ingress.kubernetes.io/url-map: k8s-um-default-tunnel-ingress--d2232907436d0807
kubectl.kubernetes.io/last-applied-configuration: "apiVersion":"extensions/v1beta1","kind":"Ingress","metadata":"annotations":,"name":"tunnel-ingress","namespace":"default","spec":"rules":["host":"abc.hbot.io","http":"paths":["backend":"serviceName":"tunnel-service","servicePort":80,"path":"/*"]]

Events:
Type Reason Age From Message
---- ------ ---- ---- -------
Normal ADD 42m loadbalancer-controller default/tunnel-ingress
Normal CREATE 40m loadbalancer-controller ip: 35.244.186.216


Not work.



Attempt #2

Add annotations



apiVersion: extensions/v1beta1
kind: Ingress
metadata:
name: tunnel-ingress
annotations:
kubernetes.io/ingress.class: "nginx"
spec:
rules:
- host: abc.hbot.io
http:
paths:
- path: /
backend:
serviceName: tunnel-service
servicePort: 80


Check the ingress



$ kubectl describe ingress
Name: tunnel-ingress
Namespace: default
Address: 35.244.186.216
Default backend: default-http-backend:80 (10.4.1.9:8080)
Rules:
Host Path Backends
---- ---- --------
abc.hbot.io
/ tunnel-service:80 (<none>)
Annotations:
ingress.kubernetes.io/backends: "k8s-be-31768--d2232907436d0807":"HEALTHY","k8s-be-32713--d2232907436d0807":"UNHEALTHY"
ingress.kubernetes.io/forwarding-rule: k8s-fw-default-tunnel-ingress--d2232907436d0807
ingress.kubernetes.io/target-proxy: k8s-tp-default-tunnel-ingress--d2232907436d0807
ingress.kubernetes.io/url-map: k8s-um-default-tunnel-ingress--d2232907436d0807
kubectl.kubernetes.io/last-applied-configuration: "apiVersion":"extensions/v1beta1","kind":"Ingress","metadata":"annotations":"kubernetes.io/ingress.class":"nginx","name":"tunnel-ingress","namespace":"default","spec":"rules":["host":"abc.hbot.io","http":"paths":["backend":"serviceName":"tunnel-service","servicePort":80,"path":"/"]]

kubernetes.io/ingress.class: nginx
Events:
Type Reason Age From Message
---- ------ ---- ---- -------
Normal ADD 54m loadbalancer-controller default/tunnel-ingress
Normal CREATE 53m loadbalancer-controller ip: 35.244.186.216



Error: Server Error
The server encountered a temporary error and could not complete your request.
Please try again in 30 seconds.




Attemp #3

Install ingress-nginx to cluster. I follow the cert-manager doc. Because I used it once with former cluster.



Follow the same name.



$ helm install stable/nginx-ingress --name quickstart

NAME: quickstart
LAST DEPLOYED: Wed Mar 27 16:09:15 2019
NAMESPACE: default
STATUS: DEPLOYED

RESOURCES:
==> v1/ConfigMap
NAME DATA AGE
quickstart-nginx-ingress-controller 1 0s

==> v1/Pod(related)
NAME READY STATUS RESTARTS AGE
quickstart-nginx-ingress-controller-5b8d54d964-rnvw6 0/1 ContainerCreating 0 0s
quickstart-nginx-ingress-default-backend-57bdfdcd46-vtf4h 0/1 Pending 0 0s

==> v1/Service
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
quickstart-nginx-ingress-controller LoadBalancer 10.7.241.190 <pending> 80:32341/TCP,443:32762/TCP 0s
quickstart-nginx-ingress-default-backend ClusterIP 10.7.254.207 <none> 80/TCP 0s

==> v1/ServiceAccount
NAME SECRETS AGE
quickstart-nginx-ingress 1 0s

==> v1beta1/ClusterRole
NAME AGE
quickstart-nginx-ingress 0s

==> v1beta1/ClusterRoleBinding
NAME AGE
quickstart-nginx-ingress 0s

==> v1beta1/Deployment
NAME READY UP-TO-DATE AVAILABLE AGE
quickstart-nginx-ingress-controller 0/1 1 0 0s
quickstart-nginx-ingress-default-backend 0/1 1 0 0s

==> v1beta1/Role
NAME AGE
quickstart-nginx-ingress 0s

==> v1beta1/RoleBinding
NAME AGE
quickstart-nginx-ingress 0s


NOTES:
The nginx-ingress controller has been installed.
It may take a few minutes for the LoadBalancer IP to be available.
You can watch the status by running 'kubectl --namespace default get services -o wide -w quickstart-nginx-ingress-controller'

An example Ingress that makes use of the controller:

apiVersion: extensions/v1beta1
kind: Ingress
metadata:
annotations:
kubernetes.io/ingress.class: nginx
name: example
namespace: foo
spec:
rules:
- host: www.example.com
http:
paths:
- backend:
serviceName: exampleService
servicePort: 80
path: /
# This section is only required if TLS is to be enabled for the Ingress
tls:
- hosts:
- www.example.com
secretName: example-tls

If TLS is enabled for the Ingress, a Secret containing the certificate and key must also be provided:

apiVersion: v1
kind: Secret
metadata:
name: example-tls
namespace: foo
data:
tls.crt: <base64 encoded cert>
tls.key: <base64 encoded key>
type: kubernetes.io/tls


describe ingress



$ kubectl describe ingress
Name: tunnel-ingress
Namespace: default
Address: 35.244.186.216
Default backend: default-http-backend:80 (10.4.1.9:8080)
Rules:
Host Path Backends
---- ---- --------
abc.hbot.io
/ tunnel-service:80 (<none>)
Annotations:
ingress.kubernetes.io/backends: "k8s-be-31768--d2232907436d0807":"HEALTHY","k8s-be-32713--d2232907436d0807":"UNHEALTHY"
ingress.kubernetes.io/forwarding-rule: k8s-fw-default-tunnel-ingress--d2232907436d0807
ingress.kubernetes.io/target-proxy: k8s-tp-default-tunnel-ingress--d2232907436d0807
ingress.kubernetes.io/url-map: k8s-um-default-tunnel-ingress--d2232907436d0807
kubectl.kubernetes.io/last-applied-configuration: "apiVersion":"extensions/v1beta1","kind":"Ingress","metadata":"annotations":"kubernetes.io/ingress.class":"nginx","name":"tunnel-ingress","namespace":"default","spec":"rules":["host":"abc.hbot.io","http":"paths":["backend":"serviceName":"tunnel-service","servicePort":80,"path":"/"]]

kubernetes.io/ingress.class: nginx
Events:
Type Reason Age From Message
---- ------ ---- ---- -------
Normal CREATE 5m12s nginx-ingress-controller Ingress default/tunnel-ingress
Normal CREATE 7s (x7 over 92m) loadbalancer-controller ip: 35.244.186.216
Normal UPDATE 7s (x13 over 5m12s) nginx-ingress-controller Ingress default/tunnel-ingress


Test with curl on my laptop



$ curl -H 'Host: abc.hbot.io' 35.244.186.216/api

<html><head>
<meta http-equiv="content-type" content="text/html;charset=utf-8">
<title>502 Server Error</title>
</head>
<body text=#000000 bgcolor=#ffffff>
<h1>Error: Server Error</h1>
<h2>The server encountered a temporary error and could not complete your request.<p>Please try again in 30 seconds.</h2>
<h2></h2>
</body></html>


Attempt 4th:

Solve insufficient cpu otherwise my new pods will not run
values.yaml



controller:
resources:
limits:
cpu: 100m
memory: 64Mi
requests:
cpu: 100m
memory: 64Mi

defaultBackend:
resources:
limits:
cpu: 10m
memory: 20Mi
requests:
cpu: 10m
memory: 20Mi


Install ingress-nginx
helm install --values values.yaml stable/nginx-ingress --name quickstart



ingress.yaml



apiVersion: extensions/v1beta1
kind: Ingress
metadata:
name: tunnel-ingress
annotations:
kubernetes.io/ingress.class: nginx

spec:
rules:
- host: abc.hbot.io
http:
paths:
- backend:
serviceName: tunnel-service
servicePort: 80
path: /


describe ingress



$ kubectl describe ingress
Name: tunnel-ingress
Namespace: default
Address: 35.240.162.185
Default backend: default-http-backend:80 (10.4.1.9:8080)
Rules:
Host Path Backends
---- ---- --------
abc.hbot.io
/ tunnel-service:80 (<none>)
Annotations:
kubectl.kubernetes.io/last-applied-configuration: "apiVersion":"extensions/v1beta1","kind":"Ingress","metadata":"annotations":"kubernetes.io/ingress.class":"nginx","name":"tunnel-ingress","namespace":"default","spec":"rules":["host":"abc.hbot.io","http":"paths":["backend":"serviceName":"tunnel-service","servicePort":80,"path":"/"]]

kubernetes.io/ingress.class: nginx
Events:
Type Reason Age From Message
---- ------ ---- ---- -------
Normal CREATE 14m nginx-ingress-controller Ingress default/tunnel-ingress
Normal CREATE 14m nginx-ingress-controller Ingress default/tunnel-ingress
Normal UPDATE 14m nginx-ingress-controller Ingress default/tunnel-ingress
Normal CREATE 9m27s nginx-ingress-controller Ingress default/tunnel-ingress


I delete and apply ingress again. IP address is changed



$ kubectl get ingress -o wide
NAME HOSTS ADDRESS PORTS AGE
tunnel-ingress abc.hbot.io 35.240.162.185 80 15m


My situation is even worse.



$ curl -H 'Host: abc.hbot.io' http://35.240.162.185/api
curl: (7) Failed to connect to 35.240.162.185 port 80: Connection refused


Final Attempt #5:

I gave up using plain http setup. And start over with https approach. By following cert-manager and then replace kuard service by my service. Then it is done!



Question:

Where am I wrong?










share|improve this question


























  • Hi, perhaps you need to use this annotation kubernetes.io/ingress.class: "nginx" if you are using nginx-ingress controller or the name of the ingress-controller in GKE

    – Suresh Vishnoi
    Mar 27 at 8:31












  • Thank you for your comment. I have updated my question refer to your comment.

    – Sarit
    Mar 27 at 8:35











  • Are you in fact using nginx-ingress controller? (did you install it?) or using the default GKE ingress mechanism? If you did not install nginx-ingress controller then you should not specify this annotation

    – Pierre B.
    Mar 27 at 8:55











  • @PierreB. No. I did not install nginx-ingress. Do I need that?

    – Sarit
    Mar 27 at 9:00











  • I think that causes your 502 when you set nginx-ingress. The default-backend error may be caused by your browser no handling DNS re-definition well (I had the same issue), a more reliable test would be to run curl -H 'Host: abc.hbot.io' 35.244.186.216 - this will make sure the Ingress rules handle your host definition

    – Pierre B.
    Mar 27 at 9:08


















1















I am practicing k8s deployment, service, and ingress implementation from here on GKE. Clicking through the simulator help me quickly understand concept, but when I do hands on. I stuck default backend - 404. Here are my manifest files and bash description.



deployment.yaml



apiVersion: apps/v1beta2
kind: Deployment
metadata:
name: tunnel-deployment
labels:
app: tunnel
spec:
replicas: 1
selector:
matchLabels:
app: tunnel
template:
metadata:
labels:
app: tunnel
spec:
containers:
- name: tunnel
image: gcr.io/k8s-v1-235608/tunnel:latest
imagePullPolicy: Always
ports:
- containerPort: 8080
env:
- name: MONGODB_HOST
value: moon-mongodb-replicaset-client
- name: RABBIT_HOST
value: rodent-rabbitmq-headless
- name: RABBIT_PASSWORD
valueFrom:
secretKeyRef:
name: rodent-rabbitmq
key: rabbitmq-password
- name: REDIS_HOST
value: ninja-redis-ha
readinessProbe:
tcpSocket:
port: 8080
initialDelaySeconds: 5
periodSeconds: 10
livenessProbe:
tcpSocket:
port: 8080
initialDelaySeconds: 15
periodSeconds: 20


See deployments in bash



$ kubectl get deployments -o wide
NAME DESIRED CURRENT UP-TO-DATE AVAILABLE AGE CONTAINERS IMAGES SELECTOR
tunnel-deployment 1 1 1 1 11m tunnel gcr.io/k8s-v1-235608/tunnel:latest app=tunnel


See po in bash



$ kubectl get po -o wide
NAME READY STATUS RESTARTS AGE IP NODE NOMINATED NODE
bbox 1/1 Running 0 1d 10.4.0.6 gke-doom-default-pool-4b763b09-pxnz <none>
moon-mongodb-replicaset-0 1/1 Running 0 1d 10.4.2.9 gke-doom-default-pool-4b763b09-lcs6 <none>
moon-mongodb-replicaset-1 1/1 Running 0 1d 10.4.0.8 gke-doom-default-pool-4b763b09-pxnz <none>
moon-mongodb-replicaset-2 1/1 Running 0 1d 10.4.2.10 gke-doom-default-pool-4b763b09-lcs6 <none>
ninja-redis-ha-server-0 2/2 Running 0 1d 10.4.0.9 gke-doom-default-pool-4b763b09-pxnz <none>
ninja-redis-ha-server-1 2/2 Running 0 1d 10.4.1.11 gke-doom-default-pool-4b763b09-85ch <none>
ninja-redis-ha-server-2 2/2 Running 0 1d 10.4.2.11 gke-doom-default-pool-4b763b09-lcs6 <none>
rodent-rabbitmq-0 1/1 Running 0 1d 10.4.2.12 gke-doom-default-pool-4b763b09-lcs6 <none>
tunnel-deployment-fddf78dcc-lpq8l 1/1 Running 0 11m 10.4.1.37 gke-doom-default-pool-4b763b09-85ch <none>


service.yaml. I use NodePort with my tunnel-service.
With my selection.app



apiVersion: v1
kind: Service
metadata:
name: tunnel-service
labels:
app: tunnel
spec:
type: NodePort
ports:
- name: tunnel-port
port: 80
targetPort: 8080
selector:
app: tunnel


Then I have single IP address to represent my service.



$ kubectl describe svc tunnel-service
Name: tunnel-service
Namespace: default
Labels: app=tunnel
Annotations: kubectl.kubernetes.io/last-applied-configuration:
{"apiVersion":"v1","kind":"Service","metadata":"annotations":,"labels":"app":"tunnel","name":"tunnel-service","namespace":"default",...
Selector: app=tunnel
Type: NodePort
IP: 10.7.242.110
Port: tunnel-port 80/TCP
TargetPort: 8080/TCP
NodePort: tunnel-port 32713/TCP
Endpoints: 10.4.1.37:8080
Session Affinity: None
External Traffic Policy: Cluster
Events: <none>


ingress.yaml. I route the / to my tunnel-service



apiVersion: extensions/v1beta1
kind: Ingress
metadata:
name: tunnel-ingress
spec:
rules:
- host: abc.hbot.io
http:
paths:
- path: /
backend:
serviceName: tunnel-service
servicePort: 80


$ kubectl describe ingress
Name: tunnel-ingress
Namespace: default
Address: 35.244.186.216
Default backend: default-http-backend:80 (10.4.1.9:8080)
Rules:
Host Path Backends
---- ---- --------
abc.hbot.io
/ tunnel-service:80 (<none>)
Annotations:
ingress.kubernetes.io/backends: "k8s-be-31768--d2232907436d0807":"HEALTHY","k8s-be-32713--d2232907436d0807":"UNHEALTHY"
ingress.kubernetes.io/forwarding-rule: k8s-fw-default-tunnel-ingress--d2232907436d0807
ingress.kubernetes.io/target-proxy: k8s-tp-default-tunnel-ingress--d2232907436d0807
ingress.kubernetes.io/url-map: k8s-um-default-tunnel-ingress--d2232907436d0807
kubectl.kubernetes.io/last-applied-configuration: "apiVersion":"extensions/v1beta1","kind":"Ingress","metadata":"annotations":,"name":"tunnel-ingress","namespace":"default","spec":"rules":["host":"abc.hbot.io","http":"paths":["backend":"serviceName":"tunnel-service","servicePort":80,"path":"/"]]

Events:
Type Reason Age From Message
---- ------ ---- ---- -------
Normal ADD 16m loadbalancer-controller default/tunnel-ingress
Normal CREATE 15m loadbalancer-controller ip: 35.244.186.216


In my browser. I had routed my hostname to my correct DNS and got default backend - 404



I confirm my pod in deployment works. My endpoint does response on my request.



bash-4.3# curl http://localhost:8080/api
Hi I'm API Interface


Update on Attempt #1:

Add * after / and apply



$ kubectl apply -f ingress.yaml
ingress.extensions/tunnel-ingress configured

$ kubectl describe ingress
Name: tunnel-ingress
Namespace: default
Address: 35.244.186.216
Default backend: default-http-backend:80 (10.4.1.9:8080)
Rules:
Host Path Backends
---- ---- --------
abc.hbot.io
/* tunnel-service:80 (<none>)
Annotations:
ingress.kubernetes.io/backends: "k8s-be-31768--d2232907436d0807":"HEALTHY","k8s-be-32713--d2232907436d0807":"UNHEALTHY"
ingress.kubernetes.io/forwarding-rule: k8s-fw-default-tunnel-ingress--d2232907436d0807
ingress.kubernetes.io/target-proxy: k8s-tp-default-tunnel-ingress--d2232907436d0807
ingress.kubernetes.io/url-map: k8s-um-default-tunnel-ingress--d2232907436d0807
kubectl.kubernetes.io/last-applied-configuration: "apiVersion":"extensions/v1beta1","kind":"Ingress","metadata":"annotations":,"name":"tunnel-ingress","namespace":"default","spec":"rules":["host":"abc.hbot.io","http":"paths":["backend":"serviceName":"tunnel-service","servicePort":80,"path":"/*"]]

Events:
Type Reason Age From Message
---- ------ ---- ---- -------
Normal ADD 42m loadbalancer-controller default/tunnel-ingress
Normal CREATE 40m loadbalancer-controller ip: 35.244.186.216


Not work.



Attempt #2

Add annotations



apiVersion: extensions/v1beta1
kind: Ingress
metadata:
name: tunnel-ingress
annotations:
kubernetes.io/ingress.class: "nginx"
spec:
rules:
- host: abc.hbot.io
http:
paths:
- path: /
backend:
serviceName: tunnel-service
servicePort: 80


Check the ingress



$ kubectl describe ingress
Name: tunnel-ingress
Namespace: default
Address: 35.244.186.216
Default backend: default-http-backend:80 (10.4.1.9:8080)
Rules:
Host Path Backends
---- ---- --------
abc.hbot.io
/ tunnel-service:80 (<none>)
Annotations:
ingress.kubernetes.io/backends: "k8s-be-31768--d2232907436d0807":"HEALTHY","k8s-be-32713--d2232907436d0807":"UNHEALTHY"
ingress.kubernetes.io/forwarding-rule: k8s-fw-default-tunnel-ingress--d2232907436d0807
ingress.kubernetes.io/target-proxy: k8s-tp-default-tunnel-ingress--d2232907436d0807
ingress.kubernetes.io/url-map: k8s-um-default-tunnel-ingress--d2232907436d0807
kubectl.kubernetes.io/last-applied-configuration: "apiVersion":"extensions/v1beta1","kind":"Ingress","metadata":"annotations":"kubernetes.io/ingress.class":"nginx","name":"tunnel-ingress","namespace":"default","spec":"rules":["host":"abc.hbot.io","http":"paths":["backend":"serviceName":"tunnel-service","servicePort":80,"path":"/"]]

kubernetes.io/ingress.class: nginx
Events:
Type Reason Age From Message
---- ------ ---- ---- -------
Normal ADD 54m loadbalancer-controller default/tunnel-ingress
Normal CREATE 53m loadbalancer-controller ip: 35.244.186.216



Error: Server Error
The server encountered a temporary error and could not complete your request.
Please try again in 30 seconds.




Attemp #3

Install ingress-nginx to cluster. I follow the cert-manager doc. Because I used it once with former cluster.



Follow the same name.



$ helm install stable/nginx-ingress --name quickstart

NAME: quickstart
LAST DEPLOYED: Wed Mar 27 16:09:15 2019
NAMESPACE: default
STATUS: DEPLOYED

RESOURCES:
==> v1/ConfigMap
NAME DATA AGE
quickstart-nginx-ingress-controller 1 0s

==> v1/Pod(related)
NAME READY STATUS RESTARTS AGE
quickstart-nginx-ingress-controller-5b8d54d964-rnvw6 0/1 ContainerCreating 0 0s
quickstart-nginx-ingress-default-backend-57bdfdcd46-vtf4h 0/1 Pending 0 0s

==> v1/Service
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
quickstart-nginx-ingress-controller LoadBalancer 10.7.241.190 <pending> 80:32341/TCP,443:32762/TCP 0s
quickstart-nginx-ingress-default-backend ClusterIP 10.7.254.207 <none> 80/TCP 0s

==> v1/ServiceAccount
NAME SECRETS AGE
quickstart-nginx-ingress 1 0s

==> v1beta1/ClusterRole
NAME AGE
quickstart-nginx-ingress 0s

==> v1beta1/ClusterRoleBinding
NAME AGE
quickstart-nginx-ingress 0s

==> v1beta1/Deployment
NAME READY UP-TO-DATE AVAILABLE AGE
quickstart-nginx-ingress-controller 0/1 1 0 0s
quickstart-nginx-ingress-default-backend 0/1 1 0 0s

==> v1beta1/Role
NAME AGE
quickstart-nginx-ingress 0s

==> v1beta1/RoleBinding
NAME AGE
quickstart-nginx-ingress 0s


NOTES:
The nginx-ingress controller has been installed.
It may take a few minutes for the LoadBalancer IP to be available.
You can watch the status by running 'kubectl --namespace default get services -o wide -w quickstart-nginx-ingress-controller'

An example Ingress that makes use of the controller:

apiVersion: extensions/v1beta1
kind: Ingress
metadata:
annotations:
kubernetes.io/ingress.class: nginx
name: example
namespace: foo
spec:
rules:
- host: www.example.com
http:
paths:
- backend:
serviceName: exampleService
servicePort: 80
path: /
# This section is only required if TLS is to be enabled for the Ingress
tls:
- hosts:
- www.example.com
secretName: example-tls

If TLS is enabled for the Ingress, a Secret containing the certificate and key must also be provided:

apiVersion: v1
kind: Secret
metadata:
name: example-tls
namespace: foo
data:
tls.crt: <base64 encoded cert>
tls.key: <base64 encoded key>
type: kubernetes.io/tls


describe ingress



$ kubectl describe ingress
Name: tunnel-ingress
Namespace: default
Address: 35.244.186.216
Default backend: default-http-backend:80 (10.4.1.9:8080)
Rules:
Host Path Backends
---- ---- --------
abc.hbot.io
/ tunnel-service:80 (<none>)
Annotations:
ingress.kubernetes.io/backends: "k8s-be-31768--d2232907436d0807":"HEALTHY","k8s-be-32713--d2232907436d0807":"UNHEALTHY"
ingress.kubernetes.io/forwarding-rule: k8s-fw-default-tunnel-ingress--d2232907436d0807
ingress.kubernetes.io/target-proxy: k8s-tp-default-tunnel-ingress--d2232907436d0807
ingress.kubernetes.io/url-map: k8s-um-default-tunnel-ingress--d2232907436d0807
kubectl.kubernetes.io/last-applied-configuration: "apiVersion":"extensions/v1beta1","kind":"Ingress","metadata":"annotations":"kubernetes.io/ingress.class":"nginx","name":"tunnel-ingress","namespace":"default","spec":"rules":["host":"abc.hbot.io","http":"paths":["backend":"serviceName":"tunnel-service","servicePort":80,"path":"/"]]

kubernetes.io/ingress.class: nginx
Events:
Type Reason Age From Message
---- ------ ---- ---- -------
Normal CREATE 5m12s nginx-ingress-controller Ingress default/tunnel-ingress
Normal CREATE 7s (x7 over 92m) loadbalancer-controller ip: 35.244.186.216
Normal UPDATE 7s (x13 over 5m12s) nginx-ingress-controller Ingress default/tunnel-ingress


Test with curl on my laptop



$ curl -H 'Host: abc.hbot.io' 35.244.186.216/api

<html><head>
<meta http-equiv="content-type" content="text/html;charset=utf-8">
<title>502 Server Error</title>
</head>
<body text=#000000 bgcolor=#ffffff>
<h1>Error: Server Error</h1>
<h2>The server encountered a temporary error and could not complete your request.<p>Please try again in 30 seconds.</h2>
<h2></h2>
</body></html>


Attempt 4th:

Solve insufficient cpu otherwise my new pods will not run
values.yaml



controller:
resources:
limits:
cpu: 100m
memory: 64Mi
requests:
cpu: 100m
memory: 64Mi

defaultBackend:
resources:
limits:
cpu: 10m
memory: 20Mi
requests:
cpu: 10m
memory: 20Mi


Install ingress-nginx
helm install --values values.yaml stable/nginx-ingress --name quickstart



ingress.yaml



apiVersion: extensions/v1beta1
kind: Ingress
metadata:
name: tunnel-ingress
annotations:
kubernetes.io/ingress.class: nginx

spec:
rules:
- host: abc.hbot.io
http:
paths:
- backend:
serviceName: tunnel-service
servicePort: 80
path: /


describe ingress



$ kubectl describe ingress
Name: tunnel-ingress
Namespace: default
Address: 35.240.162.185
Default backend: default-http-backend:80 (10.4.1.9:8080)
Rules:
Host Path Backends
---- ---- --------
abc.hbot.io
/ tunnel-service:80 (<none>)
Annotations:
kubectl.kubernetes.io/last-applied-configuration: "apiVersion":"extensions/v1beta1","kind":"Ingress","metadata":"annotations":"kubernetes.io/ingress.class":"nginx","name":"tunnel-ingress","namespace":"default","spec":"rules":["host":"abc.hbot.io","http":"paths":["backend":"serviceName":"tunnel-service","servicePort":80,"path":"/"]]

kubernetes.io/ingress.class: nginx
Events:
Type Reason Age From Message
---- ------ ---- ---- -------
Normal CREATE 14m nginx-ingress-controller Ingress default/tunnel-ingress
Normal CREATE 14m nginx-ingress-controller Ingress default/tunnel-ingress
Normal UPDATE 14m nginx-ingress-controller Ingress default/tunnel-ingress
Normal CREATE 9m27s nginx-ingress-controller Ingress default/tunnel-ingress


I delete and apply ingress again. IP address is changed



$ kubectl get ingress -o wide
NAME HOSTS ADDRESS PORTS AGE
tunnel-ingress abc.hbot.io 35.240.162.185 80 15m


My situation is even worse.



$ curl -H 'Host: abc.hbot.io' http://35.240.162.185/api
curl: (7) Failed to connect to 35.240.162.185 port 80: Connection refused


Final Attempt #5:

I gave up using plain http setup. And start over with https approach. By following cert-manager and then replace kuard service by my service. Then it is done!



Question:

Where am I wrong?










share|improve this question


























  • Hi, perhaps you need to use this annotation kubernetes.io/ingress.class: "nginx" if you are using nginx-ingress controller or the name of the ingress-controller in GKE

    – Suresh Vishnoi
    Mar 27 at 8:31












  • Thank you for your comment. I have updated my question refer to your comment.

    – Sarit
    Mar 27 at 8:35











  • Are you in fact using nginx-ingress controller? (did you install it?) or using the default GKE ingress mechanism? If you did not install nginx-ingress controller then you should not specify this annotation

    – Pierre B.
    Mar 27 at 8:55











  • @PierreB. No. I did not install nginx-ingress. Do I need that?

    – Sarit
    Mar 27 at 9:00











  • I think that causes your 502 when you set nginx-ingress. The default-backend error may be caused by your browser no handling DNS re-definition well (I had the same issue), a more reliable test would be to run curl -H 'Host: abc.hbot.io' 35.244.186.216 - this will make sure the Ingress rules handle your host definition

    – Pierre B.
    Mar 27 at 9:08














1












1








1


1






I am practicing k8s deployment, service, and ingress implementation from here on GKE. Clicking through the simulator help me quickly understand concept, but when I do hands on. I stuck default backend - 404. Here are my manifest files and bash description.



deployment.yaml



apiVersion: apps/v1beta2
kind: Deployment
metadata:
name: tunnel-deployment
labels:
app: tunnel
spec:
replicas: 1
selector:
matchLabels:
app: tunnel
template:
metadata:
labels:
app: tunnel
spec:
containers:
- name: tunnel
image: gcr.io/k8s-v1-235608/tunnel:latest
imagePullPolicy: Always
ports:
- containerPort: 8080
env:
- name: MONGODB_HOST
value: moon-mongodb-replicaset-client
- name: RABBIT_HOST
value: rodent-rabbitmq-headless
- name: RABBIT_PASSWORD
valueFrom:
secretKeyRef:
name: rodent-rabbitmq
key: rabbitmq-password
- name: REDIS_HOST
value: ninja-redis-ha
readinessProbe:
tcpSocket:
port: 8080
initialDelaySeconds: 5
periodSeconds: 10
livenessProbe:
tcpSocket:
port: 8080
initialDelaySeconds: 15
periodSeconds: 20


See deployments in bash



$ kubectl get deployments -o wide
NAME DESIRED CURRENT UP-TO-DATE AVAILABLE AGE CONTAINERS IMAGES SELECTOR
tunnel-deployment 1 1 1 1 11m tunnel gcr.io/k8s-v1-235608/tunnel:latest app=tunnel


See po in bash



$ kubectl get po -o wide
NAME READY STATUS RESTARTS AGE IP NODE NOMINATED NODE
bbox 1/1 Running 0 1d 10.4.0.6 gke-doom-default-pool-4b763b09-pxnz <none>
moon-mongodb-replicaset-0 1/1 Running 0 1d 10.4.2.9 gke-doom-default-pool-4b763b09-lcs6 <none>
moon-mongodb-replicaset-1 1/1 Running 0 1d 10.4.0.8 gke-doom-default-pool-4b763b09-pxnz <none>
moon-mongodb-replicaset-2 1/1 Running 0 1d 10.4.2.10 gke-doom-default-pool-4b763b09-lcs6 <none>
ninja-redis-ha-server-0 2/2 Running 0 1d 10.4.0.9 gke-doom-default-pool-4b763b09-pxnz <none>
ninja-redis-ha-server-1 2/2 Running 0 1d 10.4.1.11 gke-doom-default-pool-4b763b09-85ch <none>
ninja-redis-ha-server-2 2/2 Running 0 1d 10.4.2.11 gke-doom-default-pool-4b763b09-lcs6 <none>
rodent-rabbitmq-0 1/1 Running 0 1d 10.4.2.12 gke-doom-default-pool-4b763b09-lcs6 <none>
tunnel-deployment-fddf78dcc-lpq8l 1/1 Running 0 11m 10.4.1.37 gke-doom-default-pool-4b763b09-85ch <none>


service.yaml. I use NodePort with my tunnel-service.
With my selection.app



apiVersion: v1
kind: Service
metadata:
name: tunnel-service
labels:
app: tunnel
spec:
type: NodePort
ports:
- name: tunnel-port
port: 80
targetPort: 8080
selector:
app: tunnel


Then I have single IP address to represent my service.



$ kubectl describe svc tunnel-service
Name: tunnel-service
Namespace: default
Labels: app=tunnel
Annotations: kubectl.kubernetes.io/last-applied-configuration:
{"apiVersion":"v1","kind":"Service","metadata":"annotations":,"labels":"app":"tunnel","name":"tunnel-service","namespace":"default",...
Selector: app=tunnel
Type: NodePort
IP: 10.7.242.110
Port: tunnel-port 80/TCP
TargetPort: 8080/TCP
NodePort: tunnel-port 32713/TCP
Endpoints: 10.4.1.37:8080
Session Affinity: None
External Traffic Policy: Cluster
Events: <none>


ingress.yaml. I route the / to my tunnel-service



apiVersion: extensions/v1beta1
kind: Ingress
metadata:
name: tunnel-ingress
spec:
rules:
- host: abc.hbot.io
http:
paths:
- path: /
backend:
serviceName: tunnel-service
servicePort: 80


$ kubectl describe ingress
Name: tunnel-ingress
Namespace: default
Address: 35.244.186.216
Default backend: default-http-backend:80 (10.4.1.9:8080)
Rules:
Host Path Backends
---- ---- --------
abc.hbot.io
/ tunnel-service:80 (<none>)
Annotations:
ingress.kubernetes.io/backends: "k8s-be-31768--d2232907436d0807":"HEALTHY","k8s-be-32713--d2232907436d0807":"UNHEALTHY"
ingress.kubernetes.io/forwarding-rule: k8s-fw-default-tunnel-ingress--d2232907436d0807
ingress.kubernetes.io/target-proxy: k8s-tp-default-tunnel-ingress--d2232907436d0807
ingress.kubernetes.io/url-map: k8s-um-default-tunnel-ingress--d2232907436d0807
kubectl.kubernetes.io/last-applied-configuration: "apiVersion":"extensions/v1beta1","kind":"Ingress","metadata":"annotations":,"name":"tunnel-ingress","namespace":"default","spec":"rules":["host":"abc.hbot.io","http":"paths":["backend":"serviceName":"tunnel-service","servicePort":80,"path":"/"]]

Events:
Type Reason Age From Message
---- ------ ---- ---- -------
Normal ADD 16m loadbalancer-controller default/tunnel-ingress
Normal CREATE 15m loadbalancer-controller ip: 35.244.186.216


In my browser. I had routed my hostname to my correct DNS and got default backend - 404



I confirm my pod in deployment works. My endpoint does response on my request.



bash-4.3# curl http://localhost:8080/api
Hi I'm API Interface


Update on Attempt #1:

Add * after / and apply



$ kubectl apply -f ingress.yaml
ingress.extensions/tunnel-ingress configured

$ kubectl describe ingress
Name: tunnel-ingress
Namespace: default
Address: 35.244.186.216
Default backend: default-http-backend:80 (10.4.1.9:8080)
Rules:
Host Path Backends
---- ---- --------
abc.hbot.io
/* tunnel-service:80 (<none>)
Annotations:
ingress.kubernetes.io/backends: "k8s-be-31768--d2232907436d0807":"HEALTHY","k8s-be-32713--d2232907436d0807":"UNHEALTHY"
ingress.kubernetes.io/forwarding-rule: k8s-fw-default-tunnel-ingress--d2232907436d0807
ingress.kubernetes.io/target-proxy: k8s-tp-default-tunnel-ingress--d2232907436d0807
ingress.kubernetes.io/url-map: k8s-um-default-tunnel-ingress--d2232907436d0807
kubectl.kubernetes.io/last-applied-configuration: "apiVersion":"extensions/v1beta1","kind":"Ingress","metadata":"annotations":,"name":"tunnel-ingress","namespace":"default","spec":"rules":["host":"abc.hbot.io","http":"paths":["backend":"serviceName":"tunnel-service","servicePort":80,"path":"/*"]]

Events:
Type Reason Age From Message
---- ------ ---- ---- -------
Normal ADD 42m loadbalancer-controller default/tunnel-ingress
Normal CREATE 40m loadbalancer-controller ip: 35.244.186.216


Not work.



Attempt #2

Add annotations



apiVersion: extensions/v1beta1
kind: Ingress
metadata:
name: tunnel-ingress
annotations:
kubernetes.io/ingress.class: "nginx"
spec:
rules:
- host: abc.hbot.io
http:
paths:
- path: /
backend:
serviceName: tunnel-service
servicePort: 80


Check the ingress



$ kubectl describe ingress
Name: tunnel-ingress
Namespace: default
Address: 35.244.186.216
Default backend: default-http-backend:80 (10.4.1.9:8080)
Rules:
Host Path Backends
---- ---- --------
abc.hbot.io
/ tunnel-service:80 (<none>)
Annotations:
ingress.kubernetes.io/backends: "k8s-be-31768--d2232907436d0807":"HEALTHY","k8s-be-32713--d2232907436d0807":"UNHEALTHY"
ingress.kubernetes.io/forwarding-rule: k8s-fw-default-tunnel-ingress--d2232907436d0807
ingress.kubernetes.io/target-proxy: k8s-tp-default-tunnel-ingress--d2232907436d0807
ingress.kubernetes.io/url-map: k8s-um-default-tunnel-ingress--d2232907436d0807
kubectl.kubernetes.io/last-applied-configuration: "apiVersion":"extensions/v1beta1","kind":"Ingress","metadata":"annotations":"kubernetes.io/ingress.class":"nginx","name":"tunnel-ingress","namespace":"default","spec":"rules":["host":"abc.hbot.io","http":"paths":["backend":"serviceName":"tunnel-service","servicePort":80,"path":"/"]]

kubernetes.io/ingress.class: nginx
Events:
Type Reason Age From Message
---- ------ ---- ---- -------
Normal ADD 54m loadbalancer-controller default/tunnel-ingress
Normal CREATE 53m loadbalancer-controller ip: 35.244.186.216



Error: Server Error
The server encountered a temporary error and could not complete your request.
Please try again in 30 seconds.




Attemp #3

Install ingress-nginx to cluster. I follow the cert-manager doc. Because I used it once with former cluster.



Follow the same name.



$ helm install stable/nginx-ingress --name quickstart

NAME: quickstart
LAST DEPLOYED: Wed Mar 27 16:09:15 2019
NAMESPACE: default
STATUS: DEPLOYED

RESOURCES:
==> v1/ConfigMap
NAME DATA AGE
quickstart-nginx-ingress-controller 1 0s

==> v1/Pod(related)
NAME READY STATUS RESTARTS AGE
quickstart-nginx-ingress-controller-5b8d54d964-rnvw6 0/1 ContainerCreating 0 0s
quickstart-nginx-ingress-default-backend-57bdfdcd46-vtf4h 0/1 Pending 0 0s

==> v1/Service
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
quickstart-nginx-ingress-controller LoadBalancer 10.7.241.190 <pending> 80:32341/TCP,443:32762/TCP 0s
quickstart-nginx-ingress-default-backend ClusterIP 10.7.254.207 <none> 80/TCP 0s

==> v1/ServiceAccount
NAME SECRETS AGE
quickstart-nginx-ingress 1 0s

==> v1beta1/ClusterRole
NAME AGE
quickstart-nginx-ingress 0s

==> v1beta1/ClusterRoleBinding
NAME AGE
quickstart-nginx-ingress 0s

==> v1beta1/Deployment
NAME READY UP-TO-DATE AVAILABLE AGE
quickstart-nginx-ingress-controller 0/1 1 0 0s
quickstart-nginx-ingress-default-backend 0/1 1 0 0s

==> v1beta1/Role
NAME AGE
quickstart-nginx-ingress 0s

==> v1beta1/RoleBinding
NAME AGE
quickstart-nginx-ingress 0s


NOTES:
The nginx-ingress controller has been installed.
It may take a few minutes for the LoadBalancer IP to be available.
You can watch the status by running 'kubectl --namespace default get services -o wide -w quickstart-nginx-ingress-controller'

An example Ingress that makes use of the controller:

apiVersion: extensions/v1beta1
kind: Ingress
metadata:
annotations:
kubernetes.io/ingress.class: nginx
name: example
namespace: foo
spec:
rules:
- host: www.example.com
http:
paths:
- backend:
serviceName: exampleService
servicePort: 80
path: /
# This section is only required if TLS is to be enabled for the Ingress
tls:
- hosts:
- www.example.com
secretName: example-tls

If TLS is enabled for the Ingress, a Secret containing the certificate and key must also be provided:

apiVersion: v1
kind: Secret
metadata:
name: example-tls
namespace: foo
data:
tls.crt: <base64 encoded cert>
tls.key: <base64 encoded key>
type: kubernetes.io/tls


describe ingress



$ kubectl describe ingress
Name: tunnel-ingress
Namespace: default
Address: 35.244.186.216
Default backend: default-http-backend:80 (10.4.1.9:8080)
Rules:
Host Path Backends
---- ---- --------
abc.hbot.io
/ tunnel-service:80 (<none>)
Annotations:
ingress.kubernetes.io/backends: "k8s-be-31768--d2232907436d0807":"HEALTHY","k8s-be-32713--d2232907436d0807":"UNHEALTHY"
ingress.kubernetes.io/forwarding-rule: k8s-fw-default-tunnel-ingress--d2232907436d0807
ingress.kubernetes.io/target-proxy: k8s-tp-default-tunnel-ingress--d2232907436d0807
ingress.kubernetes.io/url-map: k8s-um-default-tunnel-ingress--d2232907436d0807
kubectl.kubernetes.io/last-applied-configuration: "apiVersion":"extensions/v1beta1","kind":"Ingress","metadata":"annotations":"kubernetes.io/ingress.class":"nginx","name":"tunnel-ingress","namespace":"default","spec":"rules":["host":"abc.hbot.io","http":"paths":["backend":"serviceName":"tunnel-service","servicePort":80,"path":"/"]]

kubernetes.io/ingress.class: nginx
Events:
Type Reason Age From Message
---- ------ ---- ---- -------
Normal CREATE 5m12s nginx-ingress-controller Ingress default/tunnel-ingress
Normal CREATE 7s (x7 over 92m) loadbalancer-controller ip: 35.244.186.216
Normal UPDATE 7s (x13 over 5m12s) nginx-ingress-controller Ingress default/tunnel-ingress


Test with curl on my laptop



$ curl -H 'Host: abc.hbot.io' 35.244.186.216/api

<html><head>
<meta http-equiv="content-type" content="text/html;charset=utf-8">
<title>502 Server Error</title>
</head>
<body text=#000000 bgcolor=#ffffff>
<h1>Error: Server Error</h1>
<h2>The server encountered a temporary error and could not complete your request.<p>Please try again in 30 seconds.</h2>
<h2></h2>
</body></html>


Attempt 4th:

Solve insufficient cpu otherwise my new pods will not run
values.yaml



controller:
resources:
limits:
cpu: 100m
memory: 64Mi
requests:
cpu: 100m
memory: 64Mi

defaultBackend:
resources:
limits:
cpu: 10m
memory: 20Mi
requests:
cpu: 10m
memory: 20Mi


Install ingress-nginx
helm install --values values.yaml stable/nginx-ingress --name quickstart



ingress.yaml



apiVersion: extensions/v1beta1
kind: Ingress
metadata:
name: tunnel-ingress
annotations:
kubernetes.io/ingress.class: nginx

spec:
rules:
- host: abc.hbot.io
http:
paths:
- backend:
serviceName: tunnel-service
servicePort: 80
path: /


describe ingress



$ kubectl describe ingress
Name: tunnel-ingress
Namespace: default
Address: 35.240.162.185
Default backend: default-http-backend:80 (10.4.1.9:8080)
Rules:
Host Path Backends
---- ---- --------
abc.hbot.io
/ tunnel-service:80 (<none>)
Annotations:
kubectl.kubernetes.io/last-applied-configuration: "apiVersion":"extensions/v1beta1","kind":"Ingress","metadata":"annotations":"kubernetes.io/ingress.class":"nginx","name":"tunnel-ingress","namespace":"default","spec":"rules":["host":"abc.hbot.io","http":"paths":["backend":"serviceName":"tunnel-service","servicePort":80,"path":"/"]]

kubernetes.io/ingress.class: nginx
Events:
Type Reason Age From Message
---- ------ ---- ---- -------
Normal CREATE 14m nginx-ingress-controller Ingress default/tunnel-ingress
Normal CREATE 14m nginx-ingress-controller Ingress default/tunnel-ingress
Normal UPDATE 14m nginx-ingress-controller Ingress default/tunnel-ingress
Normal CREATE 9m27s nginx-ingress-controller Ingress default/tunnel-ingress


I delete and apply ingress again. IP address is changed



$ kubectl get ingress -o wide
NAME HOSTS ADDRESS PORTS AGE
tunnel-ingress abc.hbot.io 35.240.162.185 80 15m


My situation is even worse.



$ curl -H 'Host: abc.hbot.io' http://35.240.162.185/api
curl: (7) Failed to connect to 35.240.162.185 port 80: Connection refused


Final Attempt #5:

I gave up using plain http setup. And start over with https approach. By following cert-manager and then replace kuard service by my service. Then it is done!



Question:

Where am I wrong?










share|improve this question
















I am practicing k8s deployment, service, and ingress implementation from here on GKE. Clicking through the simulator help me quickly understand concept, but when I do hands on. I stuck default backend - 404. Here are my manifest files and bash description.



deployment.yaml



apiVersion: apps/v1beta2
kind: Deployment
metadata:
name: tunnel-deployment
labels:
app: tunnel
spec:
replicas: 1
selector:
matchLabels:
app: tunnel
template:
metadata:
labels:
app: tunnel
spec:
containers:
- name: tunnel
image: gcr.io/k8s-v1-235608/tunnel:latest
imagePullPolicy: Always
ports:
- containerPort: 8080
env:
- name: MONGODB_HOST
value: moon-mongodb-replicaset-client
- name: RABBIT_HOST
value: rodent-rabbitmq-headless
- name: RABBIT_PASSWORD
valueFrom:
secretKeyRef:
name: rodent-rabbitmq
key: rabbitmq-password
- name: REDIS_HOST
value: ninja-redis-ha
readinessProbe:
tcpSocket:
port: 8080
initialDelaySeconds: 5
periodSeconds: 10
livenessProbe:
tcpSocket:
port: 8080
initialDelaySeconds: 15
periodSeconds: 20


See deployments in bash



$ kubectl get deployments -o wide
NAME DESIRED CURRENT UP-TO-DATE AVAILABLE AGE CONTAINERS IMAGES SELECTOR
tunnel-deployment 1 1 1 1 11m tunnel gcr.io/k8s-v1-235608/tunnel:latest app=tunnel


See po in bash



$ kubectl get po -o wide
NAME READY STATUS RESTARTS AGE IP NODE NOMINATED NODE
bbox 1/1 Running 0 1d 10.4.0.6 gke-doom-default-pool-4b763b09-pxnz <none>
moon-mongodb-replicaset-0 1/1 Running 0 1d 10.4.2.9 gke-doom-default-pool-4b763b09-lcs6 <none>
moon-mongodb-replicaset-1 1/1 Running 0 1d 10.4.0.8 gke-doom-default-pool-4b763b09-pxnz <none>
moon-mongodb-replicaset-2 1/1 Running 0 1d 10.4.2.10 gke-doom-default-pool-4b763b09-lcs6 <none>
ninja-redis-ha-server-0 2/2 Running 0 1d 10.4.0.9 gke-doom-default-pool-4b763b09-pxnz <none>
ninja-redis-ha-server-1 2/2 Running 0 1d 10.4.1.11 gke-doom-default-pool-4b763b09-85ch <none>
ninja-redis-ha-server-2 2/2 Running 0 1d 10.4.2.11 gke-doom-default-pool-4b763b09-lcs6 <none>
rodent-rabbitmq-0 1/1 Running 0 1d 10.4.2.12 gke-doom-default-pool-4b763b09-lcs6 <none>
tunnel-deployment-fddf78dcc-lpq8l 1/1 Running 0 11m 10.4.1.37 gke-doom-default-pool-4b763b09-85ch <none>


service.yaml. I use NodePort with my tunnel-service.
With my selection.app



apiVersion: v1
kind: Service
metadata:
name: tunnel-service
labels:
app: tunnel
spec:
type: NodePort
ports:
- name: tunnel-port
port: 80
targetPort: 8080
selector:
app: tunnel


Then I have single IP address to represent my service.



$ kubectl describe svc tunnel-service
Name: tunnel-service
Namespace: default
Labels: app=tunnel
Annotations: kubectl.kubernetes.io/last-applied-configuration:
{"apiVersion":"v1","kind":"Service","metadata":"annotations":,"labels":"app":"tunnel","name":"tunnel-service","namespace":"default",...
Selector: app=tunnel
Type: NodePort
IP: 10.7.242.110
Port: tunnel-port 80/TCP
TargetPort: 8080/TCP
NodePort: tunnel-port 32713/TCP
Endpoints: 10.4.1.37:8080
Session Affinity: None
External Traffic Policy: Cluster
Events: <none>


ingress.yaml. I route the / to my tunnel-service



apiVersion: extensions/v1beta1
kind: Ingress
metadata:
name: tunnel-ingress
spec:
rules:
- host: abc.hbot.io
http:
paths:
- path: /
backend:
serviceName: tunnel-service
servicePort: 80


$ kubectl describe ingress
Name: tunnel-ingress
Namespace: default
Address: 35.244.186.216
Default backend: default-http-backend:80 (10.4.1.9:8080)
Rules:
Host Path Backends
---- ---- --------
abc.hbot.io
/ tunnel-service:80 (<none>)
Annotations:
ingress.kubernetes.io/backends: "k8s-be-31768--d2232907436d0807":"HEALTHY","k8s-be-32713--d2232907436d0807":"UNHEALTHY"
ingress.kubernetes.io/forwarding-rule: k8s-fw-default-tunnel-ingress--d2232907436d0807
ingress.kubernetes.io/target-proxy: k8s-tp-default-tunnel-ingress--d2232907436d0807
ingress.kubernetes.io/url-map: k8s-um-default-tunnel-ingress--d2232907436d0807
kubectl.kubernetes.io/last-applied-configuration: "apiVersion":"extensions/v1beta1","kind":"Ingress","metadata":"annotations":,"name":"tunnel-ingress","namespace":"default","spec":"rules":["host":"abc.hbot.io","http":"paths":["backend":"serviceName":"tunnel-service","servicePort":80,"path":"/"]]

Events:
Type Reason Age From Message
---- ------ ---- ---- -------
Normal ADD 16m loadbalancer-controller default/tunnel-ingress
Normal CREATE 15m loadbalancer-controller ip: 35.244.186.216


In my browser. I had routed my hostname to my correct DNS and got default backend - 404



I confirm my pod in deployment works. My endpoint does response on my request.



bash-4.3# curl http://localhost:8080/api
Hi I'm API Interface


Update on Attempt #1:

Add * after / and apply



$ kubectl apply -f ingress.yaml
ingress.extensions/tunnel-ingress configured

$ kubectl describe ingress
Name: tunnel-ingress
Namespace: default
Address: 35.244.186.216
Default backend: default-http-backend:80 (10.4.1.9:8080)
Rules:
Host Path Backends
---- ---- --------
abc.hbot.io
/* tunnel-service:80 (<none>)
Annotations:
ingress.kubernetes.io/backends: "k8s-be-31768--d2232907436d0807":"HEALTHY","k8s-be-32713--d2232907436d0807":"UNHEALTHY"
ingress.kubernetes.io/forwarding-rule: k8s-fw-default-tunnel-ingress--d2232907436d0807
ingress.kubernetes.io/target-proxy: k8s-tp-default-tunnel-ingress--d2232907436d0807
ingress.kubernetes.io/url-map: k8s-um-default-tunnel-ingress--d2232907436d0807
kubectl.kubernetes.io/last-applied-configuration: "apiVersion":"extensions/v1beta1","kind":"Ingress","metadata":"annotations":,"name":"tunnel-ingress","namespace":"default","spec":"rules":["host":"abc.hbot.io","http":"paths":["backend":"serviceName":"tunnel-service","servicePort":80,"path":"/*"]]

Events:
Type Reason Age From Message
---- ------ ---- ---- -------
Normal ADD 42m loadbalancer-controller default/tunnel-ingress
Normal CREATE 40m loadbalancer-controller ip: 35.244.186.216


Not work.



Attempt #2

Add annotations



apiVersion: extensions/v1beta1
kind: Ingress
metadata:
name: tunnel-ingress
annotations:
kubernetes.io/ingress.class: "nginx"
spec:
rules:
- host: abc.hbot.io
http:
paths:
- path: /
backend:
serviceName: tunnel-service
servicePort: 80


Check the ingress



$ kubectl describe ingress
Name: tunnel-ingress
Namespace: default
Address: 35.244.186.216
Default backend: default-http-backend:80 (10.4.1.9:8080)
Rules:
Host Path Backends
---- ---- --------
abc.hbot.io
/ tunnel-service:80 (<none>)
Annotations:
ingress.kubernetes.io/backends: "k8s-be-31768--d2232907436d0807":"HEALTHY","k8s-be-32713--d2232907436d0807":"UNHEALTHY"
ingress.kubernetes.io/forwarding-rule: k8s-fw-default-tunnel-ingress--d2232907436d0807
ingress.kubernetes.io/target-proxy: k8s-tp-default-tunnel-ingress--d2232907436d0807
ingress.kubernetes.io/url-map: k8s-um-default-tunnel-ingress--d2232907436d0807
kubectl.kubernetes.io/last-applied-configuration: "apiVersion":"extensions/v1beta1","kind":"Ingress","metadata":"annotations":"kubernetes.io/ingress.class":"nginx","name":"tunnel-ingress","namespace":"default","spec":"rules":["host":"abc.hbot.io","http":"paths":["backend":"serviceName":"tunnel-service","servicePort":80,"path":"/"]]

kubernetes.io/ingress.class: nginx
Events:
Type Reason Age From Message
---- ------ ---- ---- -------
Normal ADD 54m loadbalancer-controller default/tunnel-ingress
Normal CREATE 53m loadbalancer-controller ip: 35.244.186.216



Error: Server Error
The server encountered a temporary error and could not complete your request.
Please try again in 30 seconds.




Attemp #3

Install ingress-nginx to cluster. I follow the cert-manager doc. Because I used it once with former cluster.



Follow the same name.



$ helm install stable/nginx-ingress --name quickstart

NAME: quickstart
LAST DEPLOYED: Wed Mar 27 16:09:15 2019
NAMESPACE: default
STATUS: DEPLOYED

RESOURCES:
==> v1/ConfigMap
NAME DATA AGE
quickstart-nginx-ingress-controller 1 0s

==> v1/Pod(related)
NAME READY STATUS RESTARTS AGE
quickstart-nginx-ingress-controller-5b8d54d964-rnvw6 0/1 ContainerCreating 0 0s
quickstart-nginx-ingress-default-backend-57bdfdcd46-vtf4h 0/1 Pending 0 0s

==> v1/Service
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
quickstart-nginx-ingress-controller LoadBalancer 10.7.241.190 <pending> 80:32341/TCP,443:32762/TCP 0s
quickstart-nginx-ingress-default-backend ClusterIP 10.7.254.207 <none> 80/TCP 0s

==> v1/ServiceAccount
NAME SECRETS AGE
quickstart-nginx-ingress 1 0s

==> v1beta1/ClusterRole
NAME AGE
quickstart-nginx-ingress 0s

==> v1beta1/ClusterRoleBinding
NAME AGE
quickstart-nginx-ingress 0s

==> v1beta1/Deployment
NAME READY UP-TO-DATE AVAILABLE AGE
quickstart-nginx-ingress-controller 0/1 1 0 0s
quickstart-nginx-ingress-default-backend 0/1 1 0 0s

==> v1beta1/Role
NAME AGE
quickstart-nginx-ingress 0s

==> v1beta1/RoleBinding
NAME AGE
quickstart-nginx-ingress 0s


NOTES:
The nginx-ingress controller has been installed.
It may take a few minutes for the LoadBalancer IP to be available.
You can watch the status by running 'kubectl --namespace default get services -o wide -w quickstart-nginx-ingress-controller'

An example Ingress that makes use of the controller:

apiVersion: extensions/v1beta1
kind: Ingress
metadata:
annotations:
kubernetes.io/ingress.class: nginx
name: example
namespace: foo
spec:
rules:
- host: www.example.com
http:
paths:
- backend:
serviceName: exampleService
servicePort: 80
path: /
# This section is only required if TLS is to be enabled for the Ingress
tls:
- hosts:
- www.example.com
secretName: example-tls

If TLS is enabled for the Ingress, a Secret containing the certificate and key must also be provided:

apiVersion: v1
kind: Secret
metadata:
name: example-tls
namespace: foo
data:
tls.crt: <base64 encoded cert>
tls.key: <base64 encoded key>
type: kubernetes.io/tls


describe ingress



$ kubectl describe ingress
Name: tunnel-ingress
Namespace: default
Address: 35.244.186.216
Default backend: default-http-backend:80 (10.4.1.9:8080)
Rules:
Host Path Backends
---- ---- --------
abc.hbot.io
/ tunnel-service:80 (<none>)
Annotations:
ingress.kubernetes.io/backends: "k8s-be-31768--d2232907436d0807":"HEALTHY","k8s-be-32713--d2232907436d0807":"UNHEALTHY"
ingress.kubernetes.io/forwarding-rule: k8s-fw-default-tunnel-ingress--d2232907436d0807
ingress.kubernetes.io/target-proxy: k8s-tp-default-tunnel-ingress--d2232907436d0807
ingress.kubernetes.io/url-map: k8s-um-default-tunnel-ingress--d2232907436d0807
kubectl.kubernetes.io/last-applied-configuration: "apiVersion":"extensions/v1beta1","kind":"Ingress","metadata":"annotations":"kubernetes.io/ingress.class":"nginx","name":"tunnel-ingress","namespace":"default","spec":"rules":["host":"abc.hbot.io","http":"paths":["backend":"serviceName":"tunnel-service","servicePort":80,"path":"/"]]

kubernetes.io/ingress.class: nginx
Events:
Type Reason Age From Message
---- ------ ---- ---- -------
Normal CREATE 5m12s nginx-ingress-controller Ingress default/tunnel-ingress
Normal CREATE 7s (x7 over 92m) loadbalancer-controller ip: 35.244.186.216
Normal UPDATE 7s (x13 over 5m12s) nginx-ingress-controller Ingress default/tunnel-ingress


Test with curl on my laptop



$ curl -H 'Host: abc.hbot.io' 35.244.186.216/api

<html><head>
<meta http-equiv="content-type" content="text/html;charset=utf-8">
<title>502 Server Error</title>
</head>
<body text=#000000 bgcolor=#ffffff>
<h1>Error: Server Error</h1>
<h2>The server encountered a temporary error and could not complete your request.<p>Please try again in 30 seconds.</h2>
<h2></h2>
</body></html>


Attempt 4th:

Solve insufficient cpu otherwise my new pods will not run
values.yaml



controller:
resources:
limits:
cpu: 100m
memory: 64Mi
requests:
cpu: 100m
memory: 64Mi

defaultBackend:
resources:
limits:
cpu: 10m
memory: 20Mi
requests:
cpu: 10m
memory: 20Mi


Install ingress-nginx
helm install --values values.yaml stable/nginx-ingress --name quickstart



ingress.yaml



apiVersion: extensions/v1beta1
kind: Ingress
metadata:
name: tunnel-ingress
annotations:
kubernetes.io/ingress.class: nginx

spec:
rules:
- host: abc.hbot.io
http:
paths:
- backend:
serviceName: tunnel-service
servicePort: 80
path: /


describe ingress



$ kubectl describe ingress
Name: tunnel-ingress
Namespace: default
Address: 35.240.162.185
Default backend: default-http-backend:80 (10.4.1.9:8080)
Rules:
Host Path Backends
---- ---- --------
abc.hbot.io
/ tunnel-service:80 (<none>)
Annotations:
kubectl.kubernetes.io/last-applied-configuration: "apiVersion":"extensions/v1beta1","kind":"Ingress","metadata":"annotations":"kubernetes.io/ingress.class":"nginx","name":"tunnel-ingress","namespace":"default","spec":"rules":["host":"abc.hbot.io","http":"paths":["backend":"serviceName":"tunnel-service","servicePort":80,"path":"/"]]

kubernetes.io/ingress.class: nginx
Events:
Type Reason Age From Message
---- ------ ---- ---- -------
Normal CREATE 14m nginx-ingress-controller Ingress default/tunnel-ingress
Normal CREATE 14m nginx-ingress-controller Ingress default/tunnel-ingress
Normal UPDATE 14m nginx-ingress-controller Ingress default/tunnel-ingress
Normal CREATE 9m27s nginx-ingress-controller Ingress default/tunnel-ingress


I delete and apply ingress again. IP address is changed



$ kubectl get ingress -o wide
NAME HOSTS ADDRESS PORTS AGE
tunnel-ingress abc.hbot.io 35.240.162.185 80 15m


My situation is even worse.



$ curl -H 'Host: abc.hbot.io' http://35.240.162.185/api
curl: (7) Failed to connect to 35.240.162.185 port 80: Connection refused


Final Attempt #5:

I gave up using plain http setup. And start over with https approach. By following cert-manager and then replace kuard service by my service. Then it is done!



Question:

Where am I wrong?







docker kubernetes






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Mar 28 at 3:54







Sarit

















asked Mar 27 at 8:10









SaritSarit

1,7022 gold badges21 silver badges49 bronze badges




1,7022 gold badges21 silver badges49 bronze badges















  • Hi, perhaps you need to use this annotation kubernetes.io/ingress.class: "nginx" if you are using nginx-ingress controller or the name of the ingress-controller in GKE

    – Suresh Vishnoi
    Mar 27 at 8:31












  • Thank you for your comment. I have updated my question refer to your comment.

    – Sarit
    Mar 27 at 8:35











  • Are you in fact using nginx-ingress controller? (did you install it?) or using the default GKE ingress mechanism? If you did not install nginx-ingress controller then you should not specify this annotation

    – Pierre B.
    Mar 27 at 8:55











  • @PierreB. No. I did not install nginx-ingress. Do I need that?

    – Sarit
    Mar 27 at 9:00











  • I think that causes your 502 when you set nginx-ingress. The default-backend error may be caused by your browser no handling DNS re-definition well (I had the same issue), a more reliable test would be to run curl -H 'Host: abc.hbot.io' 35.244.186.216 - this will make sure the Ingress rules handle your host definition

    – Pierre B.
    Mar 27 at 9:08


















  • Hi, perhaps you need to use this annotation kubernetes.io/ingress.class: "nginx" if you are using nginx-ingress controller or the name of the ingress-controller in GKE

    – Suresh Vishnoi
    Mar 27 at 8:31












  • Thank you for your comment. I have updated my question refer to your comment.

    – Sarit
    Mar 27 at 8:35











  • Are you in fact using nginx-ingress controller? (did you install it?) or using the default GKE ingress mechanism? If you did not install nginx-ingress controller then you should not specify this annotation

    – Pierre B.
    Mar 27 at 8:55











  • @PierreB. No. I did not install nginx-ingress. Do I need that?

    – Sarit
    Mar 27 at 9:00











  • I think that causes your 502 when you set nginx-ingress. The default-backend error may be caused by your browser no handling DNS re-definition well (I had the same issue), a more reliable test would be to run curl -H 'Host: abc.hbot.io' 35.244.186.216 - this will make sure the Ingress rules handle your host definition

    – Pierre B.
    Mar 27 at 9:08

















Hi, perhaps you need to use this annotation kubernetes.io/ingress.class: "nginx" if you are using nginx-ingress controller or the name of the ingress-controller in GKE

– Suresh Vishnoi
Mar 27 at 8:31






Hi, perhaps you need to use this annotation kubernetes.io/ingress.class: "nginx" if you are using nginx-ingress controller or the name of the ingress-controller in GKE

– Suresh Vishnoi
Mar 27 at 8:31














Thank you for your comment. I have updated my question refer to your comment.

– Sarit
Mar 27 at 8:35





Thank you for your comment. I have updated my question refer to your comment.

– Sarit
Mar 27 at 8:35













Are you in fact using nginx-ingress controller? (did you install it?) or using the default GKE ingress mechanism? If you did not install nginx-ingress controller then you should not specify this annotation

– Pierre B.
Mar 27 at 8:55





Are you in fact using nginx-ingress controller? (did you install it?) or using the default GKE ingress mechanism? If you did not install nginx-ingress controller then you should not specify this annotation

– Pierre B.
Mar 27 at 8:55













@PierreB. No. I did not install nginx-ingress. Do I need that?

– Sarit
Mar 27 at 9:00





@PierreB. No. I did not install nginx-ingress. Do I need that?

– Sarit
Mar 27 at 9:00













I think that causes your 502 when you set nginx-ingress. The default-backend error may be caused by your browser no handling DNS re-definition well (I had the same issue), a more reliable test would be to run curl -H 'Host: abc.hbot.io' 35.244.186.216 - this will make sure the Ingress rules handle your host definition

– Pierre B.
Mar 27 at 9:08






I think that causes your 502 when you set nginx-ingress. The default-backend error may be caused by your browser no handling DNS re-definition well (I had the same issue), a more reliable test would be to run curl -H 'Host: abc.hbot.io' 35.244.186.216 - this will make sure the Ingress rules handle your host definition

– Pierre B.
Mar 27 at 9:08













1 Answer
1






active

oldest

votes


















0














I never used GKE, but with AWS and ALB, the path needs to include the wildcard.
It seems that it's the same on GKE.
https://cloud.google.com/kubernetes-engine/docs/concepts/ingress#multiple_backend_services
https://cloud.google.com/kubernetes-engine/docs/tutorials/http-balancer#step_6_optional_serving_multiple_applications_on_a_load_balancer



Try to configure your ingress as follows:



apiVersion: extensions/v1beta1
kind: Ingress
metadata:
name: tunnel-ingress
spec:
rules:
- host: abc.hbot.io
http:
paths:
- path: /*
backend:
serviceName: tunnel-service
servicePort: 80





share|improve this answer

























  • Thank you for your attempt. I have updated my attempt refer to your answer.

    – Sarit
    Mar 27 at 8:26










Your Answer






StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");

StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);

else
createEditor();

);

function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);



);













draft saved

draft discarded


















StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55372449%2fdeployment-service-ingress-implemented-got-default-backend-404%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown

























1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes









0














I never used GKE, but with AWS and ALB, the path needs to include the wildcard.
It seems that it's the same on GKE.
https://cloud.google.com/kubernetes-engine/docs/concepts/ingress#multiple_backend_services
https://cloud.google.com/kubernetes-engine/docs/tutorials/http-balancer#step_6_optional_serving_multiple_applications_on_a_load_balancer



Try to configure your ingress as follows:



apiVersion: extensions/v1beta1
kind: Ingress
metadata:
name: tunnel-ingress
spec:
rules:
- host: abc.hbot.io
http:
paths:
- path: /*
backend:
serviceName: tunnel-service
servicePort: 80





share|improve this answer

























  • Thank you for your attempt. I have updated my attempt refer to your answer.

    – Sarit
    Mar 27 at 8:26















0














I never used GKE, but with AWS and ALB, the path needs to include the wildcard.
It seems that it's the same on GKE.
https://cloud.google.com/kubernetes-engine/docs/concepts/ingress#multiple_backend_services
https://cloud.google.com/kubernetes-engine/docs/tutorials/http-balancer#step_6_optional_serving_multiple_applications_on_a_load_balancer



Try to configure your ingress as follows:



apiVersion: extensions/v1beta1
kind: Ingress
metadata:
name: tunnel-ingress
spec:
rules:
- host: abc.hbot.io
http:
paths:
- path: /*
backend:
serviceName: tunnel-service
servicePort: 80





share|improve this answer

























  • Thank you for your attempt. I have updated my attempt refer to your answer.

    – Sarit
    Mar 27 at 8:26













0












0








0







I never used GKE, but with AWS and ALB, the path needs to include the wildcard.
It seems that it's the same on GKE.
https://cloud.google.com/kubernetes-engine/docs/concepts/ingress#multiple_backend_services
https://cloud.google.com/kubernetes-engine/docs/tutorials/http-balancer#step_6_optional_serving_multiple_applications_on_a_load_balancer



Try to configure your ingress as follows:



apiVersion: extensions/v1beta1
kind: Ingress
metadata:
name: tunnel-ingress
spec:
rules:
- host: abc.hbot.io
http:
paths:
- path: /*
backend:
serviceName: tunnel-service
servicePort: 80





share|improve this answer













I never used GKE, but with AWS and ALB, the path needs to include the wildcard.
It seems that it's the same on GKE.
https://cloud.google.com/kubernetes-engine/docs/concepts/ingress#multiple_backend_services
https://cloud.google.com/kubernetes-engine/docs/tutorials/http-balancer#step_6_optional_serving_multiple_applications_on_a_load_balancer



Try to configure your ingress as follows:



apiVersion: extensions/v1beta1
kind: Ingress
metadata:
name: tunnel-ingress
spec:
rules:
- host: abc.hbot.io
http:
paths:
- path: /*
backend:
serviceName: tunnel-service
servicePort: 80






share|improve this answer












share|improve this answer



share|improve this answer










answered Mar 27 at 8:22









MiLkMiLk

611 silver badge3 bronze badges




611 silver badge3 bronze badges















  • Thank you for your attempt. I have updated my attempt refer to your answer.

    – Sarit
    Mar 27 at 8:26

















  • Thank you for your attempt. I have updated my attempt refer to your answer.

    – Sarit
    Mar 27 at 8:26
















Thank you for your attempt. I have updated my attempt refer to your answer.

– Sarit
Mar 27 at 8:26





Thank you for your attempt. I have updated my attempt refer to your answer.

– Sarit
Mar 27 at 8:26








Got a question that you can’t ask on public Stack Overflow? Learn more about sharing private information with Stack Overflow for Teams.







Got a question that you can’t ask on public Stack Overflow? Learn more about sharing private information with Stack Overflow for Teams.



















draft saved

draft discarded
















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid


  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.

To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55372449%2fdeployment-service-ingress-implemented-got-default-backend-404%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

Kamusi Yaliyomo Aina za kamusi | Muundo wa kamusi | Faida za kamusi | Dhima ya picha katika kamusi | Marejeo | Tazama pia | Viungo vya nje | UrambazajiKuhusu kamusiGo-SwahiliWiki-KamusiKamusi ya Kiswahili na Kiingerezakuihariri na kuongeza habari

Swift 4 - func physicsWorld not invoked on collision? The Next CEO of Stack OverflowHow to call Objective-C code from Swift#ifdef replacement in the Swift language@selector() in Swift?#pragma mark in Swift?Swift for loop: for index, element in array?dispatch_after - GCD in Swift?Swift Beta performance: sorting arraysSplit a String into an array in Swift?The use of Swift 3 @objc inference in Swift 4 mode is deprecated?How to optimize UITableViewCell, because my UITableView lags

Access current req object everywhere in Node.js ExpressWhy are global variables considered bad practice? (node.js)Using req & res across functionsHow do I get the path to the current script with Node.js?What is Node.js' Connect, Express and “middleware”?Node.js w/ express error handling in callbackHow to access the GET parameters after “?” in Express?Modify Node.js req object parametersAccess “app” variable inside of ExpressJS/ConnectJS middleware?Node.js Express app - request objectAngular Http Module considered middleware?Session variables in ExpressJSAdd properties to the req object in expressjs with Typescript