Search Icon
Search Icon

Kubernetes Quick Start Guide

Redpanda is a modern streaming platform for mission critical workloads. With Redpanda you can get up and running with streaming quickly and be fully compatible with the Kafka ecosystem.

This quick start guide can help you get started with Redpanda for development and testing purposes. To get up and running you need to create a cluster and deploy the Redpanda operator on the cluster.

Note - Run a container inside the Kubernetes cluster to communicate with the Redpanda cluster. Currently, a load balancer is not automatically created during deployment by default.

Prerequisites

Before you start installing Redpanda you need to setup your Kubernetes environment.

Install Kubernetes, Helm, and cert-manager

You’ll need to install:

  • Kubernetes v1.16 or above

  • kubectl v1.16 or above

  • helm v3.0.0 or above

  • cert-manager v1.2.0 or above

    Follow the instructions to verify that cert-manager is ready to create certificates.

Make sure you also have these common tools installed:

To run locally

Note Make sure that you have kind configured in your path. This reference in the GO documentation can help you configure the path.

Create a Kubernetes cluster

You can either create a Kubernetes cluster on your local machine or on a cloud provider.

Kind is a tool that lets you create local Kubernetes clusters using Docker. After you install Kind, set up a cluster with:

kind create cluster

Kubectl context

Most cloud utility tools will automatically change your kubectl config file.
To check if you’re in the correct context, run the command:

kubectl config current-context

For Digital Ocean for example, the output will look similar to this:

do-nyc1-redpanda

If you’re running multiple clusters or if the config file wasn’t set up automatically, look for more information in the Kubernetes documentation.

Install cert-manager

The Redpanda operator requires cert-manager to create certificates for TLS communication. You can install cert-manager with a CRD, but here’s the command to install using helm:

helm repo add jetstack https://charts.jetstack.io && \
helm repo update && \
helm install \
cert-manager jetstack/cert-manager \
--namespace cert-manager \
--create-namespace \
--version v1.2.0 \
--set installCRDs=true

We recommend that you use the verification procedure in the cert-manager docs to verify that cert-manager is working correcly.

Use Helm to install Redpanda operator

  1. Using Helm, add the Redpanda chart repository and update it:

    helm repo add redpanda https://charts.vectorized.io/ && \
    helm repo update
  2. Just to simplify the commands, create a variable to hold the latest version number:

    export VERSION=$(curl -s https://api.github.com/repos/vectorizedio/redpanda/releases/latest | jq -r .tag_name)

    Note - You can find information about the versions of the operator in the list of operator releases.
    We’re using jq to help us. If you don’t have it installed run this command:

    sudo apt-get update && \
    sudo apt-get install jq
  3. Install the Redpanda operator CRD:

kubectl apply \
-k https://github.com/vectorizedio/redpanda/src/go/k8s/config/crd?ref=$VERSION
  1. Install the Redpanda operator on your Kubernetes cluster with:

    helm install \
    --namespace redpanda-system \
    --create-namespace redpanda-system \
    --version $VERSION \
    redpanda/redpanda-operator

Install and connect to a Redpanda cluster

After you set up Redpanda in your Kubernetes cluster, you can use our samples to install a cluster and see Redpanda in action.

Let’s try setting up a Redpanda topic to handle a stream of events from a chat application with 5 chat rooms:

  1. Create a namespace for your cluster:

    kubectl create ns chat-with-me
  2. Install a cluster from our sample files, for example the single-node cluster:

    kubectl apply \
    -n chat-with-me \
    -f https://raw.githubusercontent.com/vectorizedio/redpanda/dev/src/go/k8s/config/samples/one_node_cluster.yaml

    You can see the resource configuration options in the cluster_types file.

  3. Use rpk to work with your Redpanda nodes, for example:

    a. Check the status of the cluster:

    kubectl -n chat-with-me run -ti --rm \
    --restart=Never \
    --image docker.vectorized.io/vectorized/redpanda:$VERSION \
    -- rpk --brokers one-node-cluster-0.one-node-cluster.chat-with-me.svc.cluster.local:9092 \
    cluster info

    b. Create a topic:

    kubectl -n chat-with-me run -ti --rm \
    --restart=Never \
    --image docker.vectorized.io/vectorized/redpanda:$VERSION \
    -- rpk --brokers one-node-cluster-0.one-node-cluster.chat-with-me.svc.cluster.local:9092 \
    topic create chat-rooms -p 5

    c. Show the list of topics:

    kubectl -n chat-with-me run -ti --rm \
    --restart=Never \
    --image docker.vectorized.io/vectorized/redpanda:$VERSION \
    -- rpk --brokers one-node-cluster-0.one-node-cluster.chat-with-me.svc.cluster.local:9092 \
    topic list

As you can see, the commands from the “rpk” pod created a 5-partition topic in for the chat rooms.

Next steps

  • Check out our in-depth explanation of how to connect external clients to a Redpanda Kubernetes deployment.
  • Contact us in our Slack community so we can work together to implement your Kubernetes use cases.