Kubernetes Cluster


Kubernetes cluster that shows how to deploy and connect Go backend, React frontend, MongoDB, Redis cache with each other.

After running the cluster you can access the frontend by going to simple-frontend.io in your browser.

If you can increment the counter in:


Backend Connected

Mongo Connected

Redis Connected


  1. Minikube
  2. Kubectl
  3. Docker
  4. Git

Cluster Diagram

Create Cluster

You can create the cluster:

  1. Using scripts inside scripts directory
  2. Manually

Using Scripts Inside scripts Directory

Run the following command

bash scripts/init.sh && bash scripts/build-and-push.sh && bash scripts/apply-config-files.sh


  1. scripts/init.sh: starts minikube, enables required addons, runs local container image registry on port 5000
  2. scripts/build-and-push.sh: builds the required images and pushes them to local container image registry
  3. scripts/apply-config-files.sh: applies configuration files in configuration folder

If you want to delete all created resources by these scripts you can use use the following command bash scripts/clean.sh


Follow the following steps to create the cluster from scratch using minikube, docker, kubectl and git

  1. Start minikube

    minikube start
  2. To make the development process easier (Optional):

    1. Create in-cluster container image registry

      minikube start
      minikube addons enable registry
      kubectl port-forward --namespace kube-system service/registry "$REGISTRY_PORT":80 &
      [ -n "$(docker images -q alpine)" ] || docker pull alpine
      docker run --rm -it --network=host alpine ash -c "apk add socat && socat TCP-LISTEN:$REGISTRY_PORT,reuseaddr,fork TCP:$(minikube ip):$REGISTRY_PORT" 
    2. Push images to in-cluster registry

      docker build backend -t "$BACKEND_IMAGE_TAG"
      docker push "$BACKEND_IMAGE_TAG"
      docker build frontend -t "$FRONTEND_IMAGE_TAG"
      docker push "$FRONTEND_IMAGE_TAG"

    If you want to skip the step of creating in-cluster registry and pushing images to it, you need to use the image uploaded previously do dockerhub. You have to replace:

    localhost:5000/simple-react-frontend in connecting-frontend-backend/frontend-deployment.yaml with oradwan/simple-react-frontend


    localhost:5000/simple-go-backend in connecting-frontend-backend/backend-deployment.yaml with oradwan/simple-go-backend

  3. Enable ingress addon

    minikube addons enable ingress
  4. Add DNS records of ingress endpoint to /etc/hosts file using the following command

    DNS_RECORD="$(minikube ip) simple-backend.io simple-frontend.io"
    grep -Fxq "$DNS_RECORD" "$HOSTS_PATH" || echo "$DNS_RECORD" | sudo tee -a "$HOSTS_PATH"
  5. Create the persistent volume, persistent volume claim, config map

    kubectl apply -f configuration/pv-pvc-cm-ingress
  6. Create services, deployments

    kubectl apply -f configuration/service-deployment
  7. View minikube dashboard in the browser (Optional)

    minikube dashboard
  8. You can now access the frontend by openning simple-frontend.io in the browser


View Github