Hi Kong Nation
we want set service with Multiple backends in k8s env. kong version is 2.0,ingress-controller version is 0.8.
here are crd resource:
apiVersion: configuration.konghq.com/v1
kind: KongIngress
metadata:
annotations:
kubernetes.io/ingress.class: kong
creationTimestamp: “2020-04-16T08:54:23Z”
generation: 1
labels:
kubernetes.io/ingress.class: kong
marketName: globalmarket
name: kong-1-kongingress-ryxbwg1eix
namespace: api-test
resourceVersion: “24160561”
selfLink: /apis/configuration.konghq.com/v1/namespaces/api-test/kongingresses/kong-1-kongingress-ryxbwg1eix
uid: de5496f9-7fbf-11ea-ad11-00505685635a
proxy:
path: /api/v1
route:
methods:
- GET
- POST
- PUT
- DELETE
- PATCH
name: apitest041501
paths: - /test222
protocols: - http
strip_path: true
upstream: {}
apiVersion: extensions/v1beta1
kind: Ingress
metadata:
annotations:
kubernetes.io/ingress.class: kong
creationTimestamp: “2020-04-16T08:54:23Z”
generation: 1
labels:
kubernetes.io/ingress.class: kong
marketName: globalmarket
name: kong-1-kongingress-ryxbwg1eix
namespace: api-test
resourceVersion: “24160808”
selfLink: /apis/extensions/v1beta1/namespaces/api-test/ingresses/kong-1-kongingress-ryxbwg1eix
uid: de592833-7fbf-11ea-ad11-00505685635a
spec:
rules:
- http:
paths:- backend:
serviceName: demo5
servicePort: 8080
path: /test222 - backend:
serviceName: demo6
servicePort: 8080
path: /test222
status:
loadBalancer:
ingress: - ip: 192.168.1.62
- backend:
apiVersion: v1
kind: Service
metadata:
annotations:
configuration.konghq.com: kong-1-kongingress-ryxbwg1eix
ingress.kubernetes.io/service-upstream: “true”
system/customPorts: “”
system/lbgroup: none
system/schemaPortname: tcp-demo5-0/TCP/59268
creationTimestamp: “2020-04-10T02:06:40Z”
labels:
name: demo5
system/appName: demo5
system/svcName: demo5
name: demo5
namespace: api-test
resourceVersion: “24160562”
selfLink: /api/v1/namespaces/api-test/services/demo5
uid: eaaa7bea-7acf-11ea-ad11-00505685635a
spec:
clusterIP: 10.108.187.31
ports:
- name: tcp-demo5-0
port: 8080
protocol: TCP
targetPort: 8080
selector:
name: demo5
sessionAffinity: None
type: ClusterIP
status:
loadBalancer: {}
apiVersion: v1
kind: Service
metadata:
annotations:
configuration.konghq.com: kong-1-kongingress-ryxbwg1eix
ingress.kubernetes.io/service-upstream: “true”
system/customPorts: “”
system/lbgroup: none
system/schemaPortname: tcp-demo6-0/TCP/16710
creationTimestamp: “2020-04-16T02:30:26Z”
labels:
name: demo6
system/appName: demo6
system/svcName: demo6
name: demo6
namespace: api-test
resourceVersion: “24160563”
selfLink: /api/v1/namespaces/api-test/services/demo6
uid: 3b7eaa0a-7f8a-11ea-ad11-00505685635a
spec:
clusterIP: 10.99.152.148
ports:
- name: tcp-demo6-0
port: 8080
protocol: TCP
targetPort: 8080
selector:
name: demo6
sessionAffinity: None
type: ClusterIP
status:
loadBalancer: {}
After deployment,we find the data in postgres:
service table:
93b14734-ee23-4a14-8921-b325f5f70caa 2020-04-16 08:54:57+00 2020-04-16 08:54:57+00 api-test.demo5.8080 5 http demo5.api-test.8080.svc 80 /api/v1 60000 60000 60000 {managed-by-ingress-controller}
177ba6a4-da31-4283-a9eb-0ed3b8c6f9cd 2020-04-16 08:54:57+00 2020-04-16 08:54:57+00 api-test.demo6.8080 5 http demo6.api-test.8080.svc 80 /api/v1 60000 60000 60000 {managed-by-ingress-controller}
upstream table:
005ba66b-fff1-4572-9dc9-1e7c7482582d 2020-04-16 15:03:01+00 demo5.api-test.8080.svc none none / 10000 {“active”: {“type”: “http”, “healthy”: {“interval”: 0, “successes”: 0, “http_statuses”: [200, 302]}, “timeout”: 1, “http_path”: “/”, “https_sni”: null, “unhealthy”: {“interval”: 0, “timeouts”: 0, “tcp_failures”: 0, “http_failures”: 0, “http_statuses”: [429, 404, 500, 501, 502, 503, 504, 505]}, “concurrency”: 10, “https_verify_certificate”: true}, “passive”: {“type”: “http”, “healthy”: {“successes”: 0, “http_statuses”: [200, 201, 202, 203, 204, 205, 206, 207, 208, 226, 300, 301, 302, 303, 304, 305, 306, 307, 308]}, “unhealthy”: {“timeouts”: 0, “tcp_failures”: 0, “http_failures”: 0, “http_statuses”: [429, 500, 503]}}, “threshold”: 0} {managed-by-ingress-controller} round-robin
6eb1a215-9847-40dc-b0a5-ec9c1600c6c1 2020-04-16 15:03:01+00 demo6.api-test.8080.svc none none / 10000 {“active”: {“type”: “http”, “healthy”: {“interval”: 0, “successes”: 0, “http_statuses”: [200, 302]}, “timeout”: 1, “http_path”: “/”, “https_sni”: null, “unhealthy”: {“interval”: 0, “timeouts”: 0, “tcp_failures”: 0, “http_failures”: 0, “http_statuses”: [429, 404, 500, 501, 502, 503, 504, 505]}, “concurrency”: 10, “https_verify_certificate”: true}, “passive”: {“type”: “http”, “healthy”: {“successes”: 0, “http_statuses”: [200, 201, 202, 203, 204, 205, 206, 207, 208, 226, 300, 301, 302, 303, 304, 305, 306, 307, 308]}, “unhealthy”: {“timeouts”: 0, “tcp_failures”: 0, “http_failures”: 0, “http_statuses”: [429, 500, 503]}}, “threshold”: 0} {managed-by-ingress-controller} round-robin
route table:
fcaf9e39-db39-4916-ab00-862812997983 | 2020-04-16 08:54:57+00 | 2020-04-16 08:54:57+00 | 93b14734-ee23-4a14-8921-b325f5f70caa | {http} | {GET,POST,PUT,DELETE,PATCH} | {/test222} | 0 | t | t | api-test.kong-1-kongingress-ryxbwg1eix.00 | {managed-by-ingress-controller} | 426 | v0 | |||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
cac06a96-38da-4788-9f61-8fcef468596c | 2020-04-16 08:54:57+00 | 2020-04-16 08:54:57+00 | 177ba6a4-da31-4283-a9eb-0ed3b8c6f9cd | {http} | {GET,POST,PUT,DELETE,PATCH} | {/test222} | 0 | t | t | api-test.kong-1-kongingress-ryxbwg1eix.01 | {managed-by-ingress-controller} | 426 | v0 |
target table:
6ceb8470-c2c2-4079-98b3-eea34185a88a | 2020-04-16 08:54:57.839+00 | 005ba66b-fff1-4572-9dc9-1e7c7482582d | demo5.api-test.svc:8080 | 100 | {managed-by-ingress-controller} |
---|---|---|---|---|---|
8e6fd867-6ac4-4630-8b76-cd91c407f766 | 2020-04-16 08:54:57.839+00 | 6eb1a215-9847-40dc-b0a5-ec9c1600c6c1 | demo6.api-test.svc:8080 | 100 | {managed-by-ingress-controller} |
According to my understanding,it should create one service,route,upstream,and with two traget. is right or wrong?
I try to invoke the created api,and can invoke successfully , but it send request to the same backend everytime.how to load balancing with Multiple backends?