Konga: How to install it on Kubernetes

Created on 10 May 2019  路  25Comments  路  Source: pantsel/konga

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?

help wanted

Most helpful comment

*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.


All 25 comments

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

@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

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"

*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

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 ,
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.

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

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

Try uppercasing the env vars

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 }}

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

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?

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

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

@mshivanna , that error can be handled this way

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

ok let me give that a try

Hmmm that did not work i still see that error.

@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?

No i see it immediately. @pantsel

i used db_uri and it works now thank you @pantsel

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

@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]

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"

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?

Was this page helpful?
0 / 5 - 0 ratings

Related issues

jeremyjpj0916 picture jeremyjpj0916  路  7Comments

zhaoJone picture zhaoJone  路  8Comments

suclogger picture suclogger  路  4Comments

Edwards80 picture Edwards80  路  4Comments

amanasmuei picture amanasmuei  路  3Comments