News KrakenD Enterprise v2.5 released with API Monetization

Community Documentation

Recent changes

You are viewing a previous version of KrakenD Community Edition (v1.4) , go to the latest version

Deploying to Kubernetes

Document updated on Dec 17, 2020

Deploying KrakenD in Kubernetes requires a straightforward configuration.

Create a Dockerfile that includes the configuration of the service. That should be as simple as:

FROM devopsfaith/krakend
COPY krakend.json /etc/krakend/krakend.json

If you use flexible-configuration you might want to add a previous generation of the krakend.json file using a multi-step Docker.

From here you need to create a NodePort and send all the traffic to KrakenD.

Deployment definition YAML

The KrakenD deployment definition, in a file called deployment-definition.yaml:

apiVersion: apps/v1
kind: Deployment
metadata:
  name: krakend-deployment
spec:
  selector:
    matchLabels:
      app: krakend
  replicas: 2
  template:
    metadata:
      labels:
        app: krakend
    spec:
      containers:
      - name: krakend
        image: YOUR-KRAKEND-IMAGE:1.0.0
        ports:
        - containerPort: 8080
        imagePullPolicy: Never
        command: [ "/usr/bin/krakend" ]
        args: [ "run", "-d", "-c", "/etc/krakend/krakend.json", "-p", "8080" ]
        env:
        - name: KRAKEND_PORT
          value: "8080"

Service definition yaml

The KrakenD service definition, in a file called service-definition.yaml:

apiVersion: v1
kind: Service
metadata:
  name: krakend-service
spec:
  type: NodePort
  ports:
  - name: http
    port: 8000
    targetPort: 8080
    protocol: TCP
  selector:
    app: krakend

Registering the service

Using the kubectl command:

Register deployment 
$kubectl create -f deployment-definition.yaml
Register service 
$kubectl create -f service-definition.yaml

For a more step by step process see this blog entry.

Helm Chart

For an example of a Helm Chart, see Mikescandy contribution

Unresolved issues?

The documentation is only a piece of the help you can get! Whether you are looking for Open Source or Enterprise support, see more support channels that can help you.

We use cookies to understand how you use our site and to improve your overall experience. By continuing to use our site, you accept our Privacy Policy. More information