Skip to main content
Version: 22.2

60-Second Guide for Kubernetes

This 60-Second Guide helps you get started with Redpanda for development and testing.

Prerequisites

Verify that you have the following software installed:

  • kubectl - version 1.21 or later
  • Helm - version 3.0.0 or later
  • Go - v1.17 or later (only required for Windows setup)

Create a Kubernetes cluster

Create the kind config file to create a multi-node cluster:

cat <<EOF >kind.yaml
---
apiVersion: kind.x-k8s.io/v1alpha4
kind: Cluster
nodes:
- role: control-plane
- role: worker
- role: worker
- role: worker
EOF

Create a Kubernetes cluster:

kind create cluster --config kind.yaml

Use Helm to install Redpanda

Install Redpanda using Helm:

helm repo add redpanda https://charts.redpanda.com/
helm repo update
helm install redpanda redpanda/redpanda \
--namespace redpanda \
--create-namespace

The installation produces some notes with getting started tips:

NAME: redpanda
LAST DEPLOYED: Wed Sep 14 17:08:43 2022
NAMESPACE: redpanda
STATUS: deployed
REVISION: 1
NOTES:
Congratulations on installing redpanda!

The pods roll out in a few seconds. To check the status, run:

kubectl -n redpanda rollout status statefulset redpanda --watch

Try some sample commands, like creating a topic called test-topic:

Get the API status:

kubectl -n redpanda exec -ti redpanda-0 -c redpanda -- rpk --brokers=redpanda-0.redpanda.redpanda.svc.cluster.local.:9093 cluster info

Create a topic:

kubectl -n redpanda exec -ti redpanda-0 -c redpanda -- rpk --brokers=redpanda-0.redpanda.redpanda.svc.cluster.local.:9093 topic create test-topic

Describe the topic:

kubectl -n redpanda exec -ti redpanda-0 -c redpanda -- rpk --brokers=redpanda-0.redpanda.redpanda.svc.cluster.local.:9093 topic describe test-topic

Delete the topic:

kubectl -n redpanda exec -ti redpanda-0 -c redpanda -- rpk --brokers=redpanda-0.redpanda.redpanda.svc.cluster.local.:9093 topic delete test-topic

Wait for the Redpanda cluster to be ready:

kubectl -n redpanda rollout status statefulset redpanda --watch

When it's ready, the output should look similar to the following:

statefulset rolling update complete 3 pods at revision redpanda-8654f645b4...

Connect to your new Redpanda cluster

Set up an alias to simplify these commands:

alias rpk="kubectl -n redpanda exec -ti redpanda-0 -c redpanda -- rpk --brokers=redpanda-0.redpanda.redpanda.svc.cluster.local.:9093"

Get the API status:

rpk cluster info

Output:

CLUSTER
=======
redpanda.825b69f2-84a6-4eaf-b2dd-4a19b69dd47c

BROKERS
=======
ID HOST PORT
0* redpanda-0.redpanda.redpanda.svc.cluster.local. 9093
1 redpanda-1.redpanda.redpanda.svc.cluster.local. 9093
2 redpanda-2.redpanda.redpanda.svc.cluster.local. 9093

Create a topic:

rpk topic create test-topic

Output:

TOPIC       STATUS
test-topic OK

Describe the topic:

rpk topic describe test-topic

Output:

SUMMARY
=======
NAME test-topic
PARTITIONS 1
REPLICAS 1

CONFIGS
=======
KEY VALUE SOURCE
cleanup.policy delete DYNAMIC_TOPIC_CONFIG
compression.type producer DEFAULT_CONFIG
message.timestamp.type CreateTime DEFAULT_CONFIG
partition_count 1 DYNAMIC_TOPIC_CONFIG
redpanda.datapolicy function_name: script_name: DEFAULT_CONFIG
redpanda.remote.read false DEFAULT_CONFIG
redpanda.remote.write false DEFAULT_CONFIG
replication_factor 1 DYNAMIC_TOPIC_CONFIG
retention.bytes -1 DEFAULT_CONFIG
retention.ms 604800000 DEFAULT_CONFIG
segment.bytes 1073741824 DEFAULT_CONFIG

Produce a message into the topic:

rpk topic produce test-topic

Enter a message:

Pandas are fabulous!

Output:

Produced to partition 0 at offset 0 with timestamp 1663282629789.

Click ctrl-d (or ctrl-z on Windows) to finish sending messages to the topic.

Consume one message from the topic:

rpk topic consume test-topic --num 1

Each message is shown with its metadata, like this:

{
"topic": "test-topic",
"value": "Pandas are fabulous!",
"timestamp": 1663282936833,
"partition": 0,
"offset": 0
}

Delete the topic:

rpk topic delete test-topic

Output:

TOPIC       STATUS
test-topic OK