3 NGINX_APP=~/nginx-app.yaml
5 cat <<EOF > "${NGINX_APP}"
22 kind: ReplicationController
39 if [ -f "$HOME/.bashrc" ]; then
40 # shellcheck source=/dev/null
41 source "$HOME/.bashrc"
44 if ! kubectl get services | grep -q nginx; then
45 kubectl create -f "${NGINX_APP}"
53 while [ $attempts -gt 0 ]
55 if [ 3 == "$(kubectl get pods | grep -c -e STATUS -e Running)" ]; then
61 [ $attempts -gt 0 ] || exit 1
63 svcip=$(kubectl get services nginx -o json | grep clusterIP | cut -f4 -d'"')
65 wget -O /dev/null "http://$svcip"
66 kubectl delete -f "${NGINX_APP}"