👀 Introduction toggle






🐣 Get Started /

Deploy to Kubernetes

This document guides you to deploy Bytebase docker image to Kubernetes.

Prerequisites

Before starting, make sure you are familiar with Docker and Kubernetes.

Run on localhost

Here is a sample Kubernetes YAML file bb.yaml describing the minimal components and configuration required to run Bytebase locally.

apiVersion: apps/v1
kind: Deployment
metadata:
  name: bytebase
  namespace: default
spec:
  selector:
    matchLabels:
      app: bytebase
  template:
    metadata:
      labels:
        app: bytebase
    spec:
      containers:
      - name: bytebase
        image: bytebase/bytebase:1.3.0
        args: ["--data", "/var/opt/bytebase", "--host", "http://localhost", "--port", "8080", "--pg", "postgresql://user:secret@host:port/dbname"]
        ports:
        - containerPort: 8080
        volumeMounts:
        - name: data
          mountPath: /var/opt/bytebase
      volumes:
      - name: data
        emptyDir: {}
---
apiVersion: v1
kind: Service
metadata:
  name: bytebase-entrypoint
  namespace: default
spec:
  type: LoadBalancer
  selector:
    app: bytebase
  ports:
  - protocol: TCP
    port: 8080
    targetPort: 8080
  1. Start Bytebase with the following command:

    kubectl apply -f bb.yaml
    

    then you should see output that looks like the following:

    deployment.apps/bytebase created
    service/bytebase-entrypoint created
    
  2. Make sure everything worked by listing your deployments:

    kubectl get deployments
    

    if all is well, your deployment should be listed as follows:

    NAME       READY   UP-TO-DATE   AVAILABLE   AGE
    bytebase   1/1     1            1           10s
    

    Do the same check for your services:

    kubectl get services
    

    if all is well too, you should see output that looks like the following:

    NAME                  TYPE           CLUSTER-IP      EXTERNAL-IP   PORT(S)          AGE
    bytebase-entrypoint   LoadBalancer   10.100.36.246   localhost     8080:30254/TCP   72s
    kubernetes            ClusterIP      10.96.0.1       <none>        443/TCP          9d
    
  3. Open a browser and visit localhost:8080, you should see Bytebase.

!

For production setup, you need to make sure the container args --host, --port match exactly to the host:port address where Bytebase supposed to be visited. Please check Production Setup for more advice.

Persistent Volume

To keep data persistence in production, you need to use the Persistent Volumes in the cluster. Each cloud provider has its own solution.

For Amazon Elastic Kubernetes Service(EKS)

In AWS EKS, you can use the Amazon EBS CSI driver for persistent volumes. Follow the managing EBS CSI to add it as an Amazon EKS add-on.

For Google Kubernetes Engine(GKE)

Please follow the Persistent volumes and dynamic provisioning.