Skip to content

Instantly share code, notes, and snippets.

@mehdihasan
Last active April 28, 2020 11:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mehdihasan/e5f8524490e033e5a02ca20f48e90802 to your computer and use it in GitHub Desktop.
Save mehdihasan/e5f8524490e033e5a02ca20f48e90802 to your computer and use it in GitHub Desktop.
kafka in openshift in ubuntu

Kafka in Openshift in Ubuntu

Installing Docker

install docker

wget -qO- https://get.docker.com/ | sh

adding your user to the "docker" group:

sudo usermod -aG docker $USER

make sure docker is installed

docker version

Install Openshift

download openshift using the following command

wget https://github.com/openshift/origin/releases/download/v3.11.0/openshift-origin-client-tools-v3.11.0-0cbc58b-linux-64bit.tar.gz

unzip the tar file

tar xvf openshift-origin-client-tools*.tar.gz

moving to the right directory

cd openshift-origin-client-tools-v3.11.0-0cbc58b-linux-64bit/
sudo mv oc kubectl /usr/local/bin/

volia! Openshift has now been installed. Let's check it out:

oc version

Allow use of Insecure Docker registry.

cat << EOF | sudo tee /etc/docker/daemon.json 
 {
     "insecure-registries" : [ "172.30.0.0/16" ]
 }
EOF

Restart Docker service after adding the file.

sudo systemctl restart docker

Now, finally we can up and run Openshift,

oc cluster up --routing-suffix=<ServerPublicIP>.xip.io \
 --public-hostname=<ServerPulicDNSName>

After the server successfuly updated, you can see the following output,

The server is accessible via web console at: https://ec2-13-58-44-107.us-east-2.compute.amazonaws.com:8443

Login to openshift console using OC client

sudo oc login -u system:admin

Installing Strimzi Kafka

Deploying strimzi in openshift

oc apply -f https://github.com/strimzi/strimzi-kafka-operator/releases/download/0.17.0/strimzi-cluster-operator-0.17.0.yaml \
-n myproject

Provision the Apache Kafka cluster

oc apply -f https://raw.githubusercontent.com/strimzi/strimzi-kafka-operator/0.17.0/examples/kafka/kafka-persistent-single.yaml \
-n myproject

Check Kafka Cluster Status

sudo oc wait kafka/my-cluster \
--for=condition=Ready \
--timeout=300s -n myproject

Persistent volumes are at host directory /etc/openshift/openshift.local.pv

References

  1. Strimzi Components
  2. Strimzi Quickstart
  3. Operators
  4. Step-by-step
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment