Deploying in Kubernetes

We proceed with deployment in Kubernotes as follows:

  1. Create the mnist.yaml file with the following content:
apiVersion: extensions/v1beta1kind: Deploymentmetadata:  name: mnist-deploymentspec:  replicas: 3  template:    metadata:      labels:        app: mnist-server    spec:      containers:      - name: mnist-container        image: neurasights/mnist-serving        command:         - /bin/sh        args:         - -c         - tensorflow_model_server --model_name=mnist --model_base_path=/tmp/mnist_model        ports:        - containerPort: 8500---apiVersion: v1kind: Servicemetadata:  labels:    run: mnist-service  name: mnist-servicespec:  ports:  - port: 8500    targetPort: 8500  selector:    app: mnist-server#  type: LoadBalancer
If you are running it in AWS or GCP clouds then uncomment the LoadBalancer line ...

Get Mastering TensorFlow 1.x now with the O’Reilly learning platform.

O’Reilly members experience live online training, plus books, videos, and digital content from nearly 200 publishers.