         sleep $interval
         duration=$((duration + interval))
 
-        response_code=$(kubectl exec -n $2 $1 -c $5 -- echo 'i am alive')
+        response_code=$(kubectl exec -n $2 $1 -c $5 -- echo 'i am alive' || exit 1)
       done
 
       echo ' succeeded!'

      export CHANGE_MINIKUBE_NONE_USER=true
      sudo -E minikube start --vm-driver=none

      sleep 25

      export HOSTNAME=$(hostname)
      envsubst < deployment/kubernetes/backend-pod/containers.yaml.template > deployment/kubernetes/backend-pod/containers.yaml
      envsubst < deployment/kubernetes/frontend-pod/client-containers.yaml.template > deployment/kubernetes/frontend-pod/client-containers.yaml
      kubectl create -f $KONFIG_PROJECTROOT/deployment/kubernetes/namespace.yaml
      kubectl create -f $KONFIG_PROJECTROOT/deployment/kubernetes/backend-pod/containers.yaml
      kubectl create -f $KONFIG_PROJECTROOT/deployment/kubernetes/frontend-pod/client-containers.yaml

      sleep 5
      echo "checking if backend pod is ready"
      check_pod_ready
      export BACKEND_POD_NAME="$(kubectl get pods --namespace koding -o jsonpath="{.items[0].metadata.name}")"
      export FRONTEND_POD_NAME="$(kubectl get pods --namespace koding -o jsonpath="{.items[1].metadata.name}")"
      sleep 10

      k8s_health_check $BACKEND_POD_NAME koding 5 120 backend-services
      k8s_health_check $FRONTEND_POD_NAME koding 5 120 landing

      # guest user can only connect via localhost, a test user equivalent to guest will be created to check connectivity via POD IP.
      # more info on guest user update: https://www.rabbitmq.com/blog/2014/04/02/breaking-things-with-rabbitmq-3-3/
      k8s_health_check $BACKEND_POD_NAME koding 5 120 rabbitmq
      sleep 25
      kubectl exec -n koding $BACKEND_POD_NAME -c rabbitmq -- bash -c "rabbitmqctl add_user test test && rabbitmqctl set_user_tags test administrator && rabbitmqctl set_permissions -p / test '.*' '.*' '.*'"

      k8s_connectivity_check $BACKEND_POD_NAME koding backend-services

      echo "all services are ready"
    }

    function k8s_connectivity_check () {
      # args: $1: POD NAME, $2: NAMESPACE, $3: container name
      kubectl exec -n $2 $1 -c $3 -- bash -c "./run is_ready"
    }

    function k8s_health_check () {
      # args: $1: POD NAME, $2: NAMESPACE, $3: health check interval (recommended 5 seconds), $4: timeout duration
      declare interval=$3

      remaining_time=600

      until eval "check_pod_response"; do
        sleep 30
        let remaining_time--
        if [ $remaining_time == 0 ]; then
          echo "time out!"
