Getting "Connection Refused" in C4-W2 graded assignment "Autoscaling TensorFlow model deployments with TF Serving and Kubernetes"

My assignment is complete 90% upto starting the Kubernetes service.

student_00_0cad200c1a3a@cloudshell:~/tfserving-gke (qwiklabs-gcp-01-66cfe8bdc0f4)$ kubectl get svc image-classifier
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
image-classifier LoadBalancer 10.96.8.28 34.132.252.194 8500:30263/TCP,8501:31951/TCP 18m

As you can see my EXTERNAL-IP is 34.132.252.194

When I run the below command I get a connection refused error
student_00_0cad200c1a3a@cloudshell:~/tfserving-gke (qwiklabs-gcp-01-66cfe8bdc0f4) curl -d @locust/request-body.json -X POST http://{EXTERNAL_IP}:8501/v1/models/image_classifier:predict
curl: (7) Failed to connect to 34.132.252.194 port 8501: Connection refused

Just to make sure I am in the right path:
student_00_0cad200c1a3a@cloudshell:~/tfserving-gke (qwiklabs-gcp-01-66cfe8bdc0f4)$ ll
total 24
drwx------ 4 student_00_0cad200c1a3a student_00_0cad200c1a3a 4096 Feb 19 15:59 ./
drwxr-xr-x 9 student_00_0cad200c1a3a student_00_0cad200c1a3a 4096 Feb 19 16:17 …/
-rw------- 1 student_00_0cad200c1a3a student_00_0cad200c1a3a 505 Feb 19 15:59 Kptfile
drwxr-xr-x 3 student_00_0cad200c1a3a student_00_0cad200c1a3a 4096 Feb 19 16:18 locust/
-rw-r–r-- 1 student_00_0cad200c1a3a student_00_0cad200c1a3a 2339 Feb 19 15:59 README.md
drwxr-xr-x 2 student_00_0cad200c1a3a student_00_0cad200c1a3a 4096 Feb 19 16:10 tf-serving/

I tried with http:// as well as https:// but nothing works.

Please help me as my work is incomplete and due to this issue I am unable to finish my graded assignment.

Kind regards,
Mahendra Rathod.

1 Like

Exact same error…

student_02_04b80379f61f@cloudshell:~/tfserving-gke (qwiklabs-gcp-02-36b8eade60ac) curl -d @locust/request-body.json -X POST http://{EXTERNAL_IP}:8501/v1/models/image_classifier:predict
curl: (7) Failed to connect to 34.67.86.244 port 8501: Connection refused

1 Like

Hi guys,

I cannot help you with this specialization but I would advise to post on the specializations page not in the general section, there the relevant mentors can pick it up.

Anyone get any help here? I have the same issue. I believe it’s stemming from the fact that the kubectl get deployments never finishes/shows 1/1.

I’m getting the same error and also see that kubectl get deployments shows 0/1 ready despite an age of 45m. Did you just let the lab time out then? I’m not sure what to do to complete…

For anyone seeing this in the future, I had the same problem and fixed it. In Task 4 it’s very easy to overlook the step 1 part where you have to actually edit configmap.yaml. The Task 4 says this:

Use your preferred command line editor or Cloud Shell Editor to update the MODEL_PATH field in the tf-serving/configmap.yaml file to reference your bucket. Recall that the bucket name was stored in the $MODEL_BUCKET environment variable

If you missed this step, then you’ll get the issues mentioned in this thread.

I posted detailed fix steps in reply to Chris Favila’s suggestion found here (C4W2 - GRADED LAB ISSUE: gcp auth plugin is deprecated - ConfigMap unchanged - #4 by chris.favila). If you missed the Task 4 step 1, then to fix it the short answer is you have to edit the configmap.yaml to update the line 21 “MODEL_PATH:” to be gs://your_quik_labs_project_id-bucket/resnet_101, then delete the old deployment using “kubectl delete deploy image-classifier”, then re-run the command “kubectl apply -f tf-serving/deployment.yaml”. Wait 2-3 minutes and then run command “kubectl get deployments”. If it is not 1/1 then it’s not yet ready. After it’s ready, all the later commands should work.

1 Like

Thank you! I have actually edited the config map and I still get this error. I really don’t recommend the kubectl delete deployment image-classifier because the tf-serving directory is gone afterwards, and I could not redo the deployment.