[SOLVED] When I try to acess kong admin API I get 400 Bad Request or eternal page loading

#1

Kubernetes version

Client Version: version.Info{Major:"1", Minor:"13", GitVersion:"v1.13.4", GitCommit:"c27b913fddd1a6c480c229191a087698aa92f0b1", GitTreeState:"archive", BuildDate:"2019-03-14T11:22:31Z", GoVersion:"go1.12", Compiler:"gc", Platform:"linux/amd64"}
Server Version: version.Info{Major:"1", Minor:"13", GitVersion:"v1.13.4", GitCommit:"c27b913fddd1a6c480c229191a087698aa92f0b1", GitTreeState:"clean", BuildDate:"2019-02-28T13:30:26Z", GoVersion:"go1.11.5", Compiler:"gc", Platform:"linux/amd64"}

Environment

  • Minikube:
    minikube version: v0.35.0

  • Helm:

Client: &version.Version{SemVer:"v2.13.0", GitCommit:"79d07943b03aea2b76c12644b4b54733bc5958d6", GitTreeState:"clean"}
Server: &version.Version{SemVer:"v2.13.0", GitCommit:"79d07943b03aea2b76c12644b4b54733bc5958d6", GitTreeState:"clean"}

What happened

I install kong via helm and when I try to acess kong admin API I git an error or a β€œpage loading forever”

Expected behvaior

After kong intallation kong admin API should be reacheble

Steps To Reproduce

  1. minikube delete
  2. minikube start
$ minikube start 
πŸ˜„  minikube v0.35.0 on linux (amd64)
πŸ”₯  Creating virtualbox VM (CPUs=2, Memory=2048MB, Disk=20000MB) ...
πŸ“Ά  "minikube" IP address is 192.168.99.108
🐳  Configuring Docker as the container runtime ...
✨  Preparing Kubernetes environment ...
🚜  Pulling images required by Kubernetes v1.13.4 ...
πŸš€  Launching Kubernetes v1.13.4 using kubeadm ... 
βŒ›  Waiting for pods: apiserver proxy etcd scheduler controller addon-manager dns
πŸ”‘  Configuring cluster permissions ...
πŸ€”  Verifying component health .....
πŸ’—  kubectl is now configured to use "minikube"
πŸ„  Done! Thank you for using minikube!
  1. Create helm-rbac.yaml file with the following content:
apiVersion: v1
kind: ServiceAccount
metadata:
  name: tiller
  namespace: kube-system
---
apiVersion: rbac.authorization.k8s.io/v1beta1
kind: ClusterRoleBinding
metadata:
  name: tiller
roleRef:
  apiGroup: rbac.authorization.k8s.io
  kind: ClusterRole
  name: cluster-admin
subjects:
  - kind: ServiceAccount
    name: tiller
    namespace: kube-system
  1. Create helm rbac:

kubectl create -f helm-rbac.yaml

  1. Init helm:

helm init --service-account tiller

  1. Install kong:

helm install stable/kong --name kong-develop --set ingressController.enabled=true

the command execution generates the following output:

LAST DEPLOYED: Thu Mar 21 14:29:46 2019
NAMESPACE: default
STATUS: DEPLOYED

RESOURCES:
==> v1/Job
NAME                               COMPLETIONS  DURATION  AGE
kong-develop-kong-init-migrations  0/1          0s        0s

==> v1/Pod(related)
NAME                                          READY  STATUS    RESTARTS  AGE
kong-develop-kong-688dd67466-zmggz            0/1    Init:0/1  0         0s
kong-develop-kong-controller-b969fb847-s9h7d  0/2    Init:0/1  0         0s
kong-develop-kong-init-migrations-sppvb       0/1    Init:0/1  0         0s
kong-develop-postgresql-0                     0/1    Init:0/1  0         0s

==> v1/Secret
NAME                     TYPE    DATA  AGE
kong-develop-postgresql  Opaque  1     8s

==> v1/Service
NAME                              TYPE       CLUSTER-IP      EXTERNAL-IP  PORT(S)                     AGE
kong-develop-kong-admin           NodePort   10.101.121.102  <none>       8444:30330/TCP              0s
kong-develop-kong-proxy           NodePort   10.100.34.254   <none>       80:31191/TCP,443:32414/TCP  0s
kong-develop-postgresql           ClusterIP  10.100.149.3    <none>       5432/TCP                    0s
kong-develop-postgresql-headless  ClusterIP  None            <none>       5432/TCP                    0s

==> v1/ServiceAccount
NAME               SECRETS  AGE
kong-develop-kong  1        8s

==> v1beta1/ClusterRole
NAME               AGE
kong-develop-kong  0s

==> v1beta1/ClusterRoleBinding
NAME               AGE
kong-develop-kong  0s

==> v1beta1/CustomResourceDefinition
NAME                                      AGE
kongconsumers.configuration.konghq.com    4s
kongcredentials.configuration.konghq.com  0s
kongingresses.configuration.konghq.com    0s
kongplugins.configuration.konghq.com      0s

==> v1beta1/Role
NAME               AGE
kong-develop-kong  0s

==> v1beta1/RoleBinding
NAME               AGE
kong-develop-kong  0s

==> v1beta2/Deployment
NAME                          READY  UP-TO-DATE  AVAILABLE  AGE
kong-develop-kong             0/1    1           0          0s
kong-develop-kong-controller  0/1    1           0          0s

==> v1beta2/StatefulSet
NAME                     READY  AGE
kong-develop-postgresql  0/1    0s


NOTES:
1. Kong Admin can be accessed inside the cluster using:
     DNS=kong-develop-kong-admin.default.svc.cluster.local
     PORT=8444

To connect from outside the K8s cluster:
     HOST=$(kubectl get nodes --namespace default -o jsonpath='{.items[0].status.addresses[0].address}')
     PORT=$(kubectl get svc --namespace default kong-develop-kong-admin -o jsonpath='{.spec.ports[0].nodePort}')


2. Kong Proxy can be accessed inside the cluster using:
     DNS=kong-develop-kong-proxy.default.svc.cluster.localPORT=443To connect from outside the K8s cluster:
     HOST=$(kubectl get nodes --namespace default -o jsonpath='{.items[0].status.addresses[0].address}')
     PORT=$(kubectl get svc --namespace default kong-develop-kong-proxy -o jsonpath='{.spec.ports[0].nodePort}')
  1. HOST=$(kubectl get nodes --namespace default -o jsonpath=’{.items[0].status.addresses[0].address}’) output: 10.0.2.15

  2. PORT=$(kubectl get svc --namespace default kong-develop-kong-proxy -o jsonpath=’{.spec.ports[0].nodePort}’) output: 30330

  3. If I open the browser and type 10.0.2.15:30330 I get eternal page loading or connection refused.

  4. Get minikube service list:

minikube service list

the command above generated the following output:

NAMESPACE NAME URL
default kong-develop-kong-admin http://192.168.99.108:30330
default kong-develop-kong-proxy http://192.168.99.108:31191
http://192.168.99.108:32414
default kong-develop-postgresql No node port
default kong-develop-postgresql-headless No node port
default kubernetes No node port
kube-system kube-dns No node port
kube-system kubernetes-dashboard No node port
kube-system tiller-deploy No node port
  1. If I open the browser and type http://192.168.99.108:30330/ (minikube service kong-admin) I get 400 Bad Request
0 Likes

#2

Hi guys!

The problem was solved!

@hbagdi helped me here.

Thanks!

0 Likes