konga icon indicating copy to clipboard operation
konga copied to clipboard

How to install it on Kubernetes

Open engmsaleh opened this issue 5 years ago • 27 comments

I need help as I need to install it on Kubernetes, I have already installed Kong Ingress controller, but I don't understand how I would install and Integrate Konga with it? I don't see any Helm or any familiar way to me, Please advise?

engmsaleh avatar May 09 '19 23:05 engmsaleh

You must set connection of konga admin URL connection to KongIngress default port 8001 admin of kong

kmandev avatar May 14 '19 08:05 kmandev

@farkramdev This is not what I want, I'm asking as I don't see any helm or yml deployment files, so How to install it on the kubernetes

engmsaleh avatar May 14 '19 11:05 engmsaleh

This should get you close:

#########################################################
# DEPLOYMENT
#########################################################
apiVersion: apps/v1beta2
kind: Deployment
metadata:
  name: "konga"
  labels:
    application: "konga"
    namespace: "%{namespace}"
    helm.sh/chart: {{ include "..chart" . }}
spec:
  replicas: 2
  strategy:
    # indicate which strategy we want for rolling update
    type: RollingUpdate
    rollingUpdate:
      maxSurge: 1
      maxUnavailable: 1
  minReadySeconds: 5
  # Ignore linter error, this has to be an int
  selector:
    matchLabels:
       application: "konga"
  template:
    metadata:
      labels:
        application: "konga"
    spec:
      affinity:
        podAntiAffinity:
          requiredDuringSchedulingIgnoredDuringExecution:
          - labelSelector:
              matchExpressions:
              - key: app
                operator: In
                values:
                - "konga"
            topologyKey: kubernetes.io/hostname
      containers:
        - name: "konga"
          image: "pantsel/konga"
          imagePullPolicy: Always
          ports:
            - name: "%{application}-http"
              # Ignore linter error, this has to be an int
              containerPort: 1337
              protocol: TCP
          envFrom:
            - configMapRef:
                name: "%{application}-config"
          resources:
            requests:
              memory: 3Gi
              cpu: .5
            limits:
              memory: 4Gi
              cpu: 2
---
#########################################################
# HPA
#########################################################
apiVersion: autoscaling/v2beta1
kind: HorizontalPodAutoscaler
metadata:
  name: "konga"
  labels:
    application: "konga"
    namespace: "%{namespace}"
    helm.sh/chart: {{ include "..chart" . }}
spec:
  scaleTargetRef:
    apiVersion: apps/v1beta2
    kind: Deployment
    name: "kongadmin"
  minReplicas: %{autoscale::web::minReplicas}
  maxReplicas: %{autoscale::web::maxReplicas}
  targetCPUUtilizationPercentage: %{autoscale::web::cpulimit}
---
#########################################################
# PDB
#########################################################
apiVersion: policy/v1beta1
kind: PodDisruptionBudget
metadata:
  name: "konga"
  labels:
    application: "konga"
    namespace: "%{namespace}"
    helm.sh/chart: {{ include "..chart" . }}
spec:
  minAvailable: %{autoscale::web::minReplicas}
  selector:
    matchLabels:
      application: "konga"
---
#########################################################
# SERVICE
#########################################################
apiVersion: v1
kind: Service
metadata:
  name: "konga"
  labels:
    dns: route53
    application: "konga"
    namespace: "%{namespace}"
    helm.sh/chart: {{ include "..chart" . }}
    external-dns.alpha.kubernetes.io/hostname: "%{domain::kong::admin}"
    external-dns.alpha.kubernetes.io/ttl: "300"
spec:
  type: NodePort
  ports:
    - port: 1337
      targetPort: 1337
      protocol: TCP
  selector:
    application: "konga"

configmap.yaml

apiVersion: v1
kind: ConfigMap
metadata:
  name: "%{application}-config"
  labels:
    application: "%{application}"
    namespace: "%{namespace}"
    helm.sh/chart: {{ include "..chart" . }}
data:
  ########################################################################################
  # Global Environment Variables that are common for most apps
  ########################################################################################
  APP_NAME: "%{application}"
  APP_VERSION: {{ include "..chart" . }}
  AWS_REGION: "%{global::aws_region}"
  NODE_ENV: "%{environment}"
  ENVIRONMENT: "%{environment}"
  LOG_LEVEL: "INFO"

  ########################################################################################
  # Application
  ########################################################################################
  TOKEN_SECRET: "%{token::secret}"
  DB_ADAPTER: "postgres"
  DB_HOST: "%{db::host}"
  DB_PORT: "5432"
  DB_USER: "%{db::user}"
  DB_PASSWORD: "%{db::password}"
  DB_DATABASE: "kongadmin"

Jinkxed avatar May 17 '19 15:05 Jinkxed

Hi, Please clone the repo. Navigate to below chart location. https://github.com/pantsel/konga/tree/master/charts/konga and execute below helm command. helm install -f ./values.yaml ../konga --namespace kong --wait ------------------------------ Note:- Please, execute above helm command in kong namespace. It's working for me. I am facing issues only with the ingress path. You can disable ingress and install other components. If you have any issues, please let me know or ignore me. If you have already installed. ------------------------------

Thanks @pradeepkumarreddynarsing and @sc-chad I will check both

engmsaleh avatar May 20 '19 23:05 engmsaleh

has anyone tried to use postgresql or mysql for persistence in konga. i always get an error even though i have specified the correct url for postgresql. `Error creating a connection to Postgresql using the following settings: ?host=alternating-mole-postgresql&port=5432&schema=true&ssl=false&adapter=sails-postgresql&user=postgres&password=oursecretpassword&database=konga_database&poolSize=10&identity=postgres


Complete error details: { Error: connect ECONNREFUSED 127.0.0.1:5432 at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1106:14) errno: 'ECONNREFUSED', code: 'ECONNREFUSED', syscall: 'connect', address: '127.0.0.1', port: 5432 }`

Not sure why its trying to connect to 127.0.0.1 when i have specified DB_HOST

mshivanna avatar Oct 22 '19 08:10 mshivanna

@mshivanna , first of all, the adapter should be postgresql not sails-postgresql.

Secondly, you either need to only specify DB_URI and pass the full connection string, or specify DB_HOST,DB_PORT,DB_USER,PASSWORD and DB_DATABASE explicitly.

pantsel avatar Oct 22 '19 09:10 pantsel

config:
#   port: 1337
  node_env: development
#   ssl_key_path:
#   ssl_crt_path:
#   konga_hook_timeout: 60000
  db_adapter: postgres
  # db_uri:
  db_host: alternating-mole-postgresql
  db_port: 5432
  db_user: postgres
  db_password: ourpassword
  db_database: konga_database
  db_pg_schema: public
  log_level: debug

mshivanna avatar Oct 22 '19 09:10 mshivanna

@pantsel thats the current config. thanks for a quick response

mshivanna avatar Oct 22 '19 09:10 mshivanna

Try uppercasing the env vars

pantsel avatar Oct 22 '19 09:10 pantsel

hmmm that might not work right? because the above configs are read in the configmap DB_USER: {{ .Values.config.db_user }} DB_PASSWORD: {{ .Values.config.db_password }} DB_DATABASE: {{ default "konga_database" .Values.config.db_database }}

mshivanna avatar Oct 22 '19 09:10 mshivanna

Just to clarify i am using the helm chart which is provided here and passing postgresql details in the values.yaml file.

mshivanna avatar Oct 22 '19 09:10 mshivanna

OK, so the actual env vars are indeed uppercase and still somehow are not being read? Unfortunatelly I have no experience with K8s but I can guarantee that those env vars should work. Maybe someone with k8s experience could chip in and help out?

pantsel avatar Oct 22 '19 09:10 pantsel

yes i execed into the pod and i do the see the env vars present correctly.

mshivanna avatar Oct 22 '19 09:10 mshivanna

i also see error: A hook (orm) failed to load! in the log

mshivanna avatar Oct 22 '19 10:10 mshivanna

@mshivanna , that error can be handled this way

https://github.com/pantsel/konga#4-the-hook-grunt-is-taking-too-long-to-load

pantsel avatar Oct 22 '19 10:10 pantsel

ok let me give that a try

mshivanna avatar Oct 22 '19 10:10 mshivanna

Hmmm that did not work i still see that error.

mshivanna avatar Oct 22 '19 10:10 mshivanna

@mshivanna , maybe its the same problem where env vars are not being read by the program? Does is actualy take 2mins before you see the error?

pantsel avatar Oct 22 '19 10:10 pantsel

No i see it immediately. @pantsel

mshivanna avatar Oct 22 '19 14:10 mshivanna

i used db_uri and it works now thank you @pantsel

mshivanna avatar Oct 28 '19 10:10 mshivanna

i followed your instruction to install konga but can u tell me how to estabilish connection with kong @pradeepkumarreddynarsing

DikshaTomar101 avatar Jun 08 '20 09:06 DikshaTomar101

@DikshaTomar101 i think i am late in party but you can use the admin service or api of kong to connect kong with konga.

also i am getting this weird error any idea : Error: unable to build kubernetes objects from release manifest: error validating "": error validating data: [unknown object type "nil" in ConfigMap.data.SSL_CRT_PATH, unknown object type "nil" in ConfigMap.data.SSL_KEY_PATH, unknown object type "nil" in ConfigMap.data.TOKEN_SECRET]

harsh4870 avatar Feb 23 '21 13:02 harsh4870

Hi, this my working YAML:

apiVersion: v1
kind: Service
metadata:
  name: konga-svc
spec:
  type: LoadBalancer
  ports:
    - name: konga-proxy
      port: 1337
      targetPort: 1337
      protocol: TCP
  selector:
    app: konga
---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: konga
spec:
  replicas: 1
  selector:
    matchLabels:
      app: konga
  template:
    metadata:
      labels:
        name: konga
        app: konga
    spec:
      containers:
        - name: konga
          image: pantsel/konga
          ports:
            - containerPort: 1337
          env:
            - name: NO_AUTH
              value: "false"
            - name: DB_ADAPTER
              value: "mysql"
            - name: DB_URI
              value: "mysql://admin:[email protected]/konga"

zimbres avatar Mar 07 '21 05:03 zimbres

Hi, this my working YAML:

apiVersion: v1
kind: Service
metadata:
  name: konga-svc
spec:
  type: LoadBalancer
  ports:
    - name: konga-proxy
      port: 1337
      targetPort: 1337
      protocol: TCP
  selector:
    app: konga
---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: konga
spec:
  replicas: 1
  selector:
    matchLabels:
      app: konga
  template:
    metadata:
      labels:
        name: konga
        app: konga
    spec:
      containers:
        - name: konga
          image: pantsel/konga
          ports:
            - containerPort: 1337
          env:
            - name: NO_AUTH
              value: "false"
            - name: DB_ADAPTER
              value: "mysql"
            - name: DB_URI
              value: "mysql://admin:[email protected]/konga"

and the command line? can you give?

uncodead avatar May 12 '21 22:05 uncodead

@harsh4870 I am getting same error. Did you find any resolution? If yes, please share with me as well.

izaz-cg avatar Nov 23 '21 06:11 izaz-cg

@izaz-cg here you go : https://faun.pub/kong-api-gateway-with-konga-dashboard-ae95b6d1fec7 everything i have used is here. still you face issue please let me know will take time out and help you

harsh4870 avatar Nov 23 '21 07:11 harsh4870