Kong 微服务网关在 Kubernetes 的实践_qhh0205-CSDN博客
k8s平台集成kong ingress 布署konga集成ui - 资本主义接班人 - 博客园 (cnblogs.com)
# 部署eks下的kong ingress kubectl create -f https://bit.ly/k4k8s # 将service loadbalance 的elb拿出来 export PROXY_IP=$(kubectl get -o jsonpath="{.status.loadBalancer.ingress[0].hostname}" service -n kong kong-proxy)
默认下admin不对外开放,并且只有https
# admin地址修改 # kong dp - name: KONG_ADMIN_LISTEN value: '0.0.0.0:8001, 0.0.0.0:8444 ssl' - name: CONTROLLER_KONG_ADMIN_URL value: 'http://0.0.0.0:8001' # kong svc - name: admin protocol: TCP port: 8001 targetPort: 8001
export PROXY_IP=$(kubectl get -o jsonpath="{.status.loadBalancer.ingress[0].hostname}" service -n kong kong-proxy)
# 测试地址 curl -i $PROXY_IP HTTP/1.1 404 Not Found Date: Sat, 08 May 2021 05:54:01 GMT Content-Type: application/json; charset=utf-8 Connection: keep-alive Content-Length: 48 X-Kong-Response-Latency: 0 Server: kong/2.3.3 {"message":"no Route matched with those values"}
echo-server测试
kubectl apply -f https://bit.ly/echo-service
echo " apiVersion: extensions/v1beta1 kind: Ingress metadata: name: demo annotations: kubernetes.io/ingress.class: kong spec: rules: - http: paths: - path: /foo backend: serviceName: echo servicePort: 80 " | kubectl apply -f -
curl -i $PROXY_IP/foo
konga
apiVersion: v1 kind: Service metadata: name: konga namespace: kong spec: ports: - name: konga port: 1337 targetPort: 1337 protocol: TCP selector: app: konga --- apiVersion: apps/v1 kind: Deployment metadata: name: konga namespace: kong labels: app: konga spec: replicas: 1 selector: matchLabels: app: konga template: metadata: labels: app: konga spec: containers: - name: konga image: pantsel/konga:0.14.9 ports: - name: konga containerPort: 1337 protocol: TCP --- apiVersion: extensions/v1beta1 kind: Ingress metadata: name: konga namespace: kong annotations: kubernetes.io/ingress.class: traefik spec: rules: - host: test-konga.91rrb.com http: paths: - backend: serviceName: konga servicePort: 1337
进入konga后,添加kong地址:
http://kong-proxy:8001