Skip to content
Cris Simpson edited this page Apr 6, 2021 · 1 revision

Introduction

I've started a Kubernetes (k8s) setup in the 'k8sify' fork, with the config files in the k8s_conf directory. I'm using KinD (Kubernetes in Docker) so the cluster setup may differ but once running, kubectl should behave the same across any provider.

Welcome to Kubernetes!

Some light reading: https://kubernetes.io/docs/concepts/
FYI, The Kubernetes and Docker extensions for VSCode make all of this easier.

Create cluster

Run the kind_w_reg.sh script to create a Kind cluster with a local Docker image registry/storage. [1]
N.B: You will want to stop the registry container when running locally to prevent a conflict on port 5000

Tag your Docker images

Add the following tags to the appropriate existing Docker images:

  • localhost:5000/postgres:11.3-alpine
  • localhost:5000/src-client:latest
  • localhost:5000/src-server:latest

e.g., docker tag src_client localhost:5000/src-client:latest (the VSCode Docker extension is your friend)

Push each image to the local registry

docker push <tag> e.g., docker push localhost:5000/src-server:latest (Or use Docker extension)

Deploy the images

From the src directory, kubectl -f k8s_conf will execute ('apply') all the yaml files in the k8s_conf directory. You can specify an individual file, too.

Wait a minute or so and then run kubectl get pods to see the status of your running pods. You should see three with status RUNNING. Though they are happily running, they can only be accessed from inside the cluster.

Make client available for access

kubectl port-forward service/client 3000:3000 will make the PDP client available at localhost:3000

Troubleshooting

I've surely missed a step or two along the way so be sure to let me know if you run into trouble.

Notes

[1] Registry setup: https://docs.docker.com/registry/deploying/

(This was originally at https://github.com/c-simpson/paws-data-pipeline/wiki/Kubernetes-setup)