C4W2 Assignment Autoscaling TensorFlow model deployments with TF Serving and Kubernetes

After further investigation, it seems that the latest tf-serving image is the cause.
The latest image on Docker hub was updated on Aug 30.
To fix this, you need to change the image (to something like 2.8.0) on the deployment manifest.
After that change, your tf-serving/deployment.yaml should look something like this:

apiVersion: apps/v1
kind: Deployment
metadata: # kpt-merge: default/image-classifier
  name: image-classifier
  namespace: default
  labels:
    app: image-classifier
spec:
  replicas: 1
  selector:
    matchLabels:
      app: image-classifier
  template:
    metadata:
      labels:
        app: image-classifier
    spec:
      containers:
      - name: tf-serving
        image: "tensorflow/serving:2.8.0"
        args:
        - "--model_name=$(MODEL_NAME)"
        - "--model_base_path=$(MODEL_PATH)"
        envFrom:
        - configMapRef:
            name: tfserving-configs
        imagePullPolicy: IfNotPresent
        readinessProbe:
          tcpSocket:
            port: 8500
          initialDelaySeconds: 10
          periodSeconds: 5
          failureThreshold: 10
        ports:
        - name: http
          containerPort: 8501
          protocol: TCP
        - name: grpc
          containerPort: 8500
          protocol: TCP
        resources:
          requests:
            cpu: "3"
            memory: 4Gi

Please note that you need to do this after passing the assessment of “Task 5. Creating TensorFlow Serving deployment”, because it seems that the assessment also check the tf-serving version.

So in short, what you need to do is:

  1. Do as the instruction says up to assessment on task 5 completed.
  2. Update the deployment manifest as shown above, and apply it one more time i.e.
    kubectl apply -f tf-serving/deployment.yaml
  3. The rest is as instructed in the lab.

Until we get official clarification, I hope this helps.

5 Likes