Skip to content

Instantly share code, notes, and snippets.

@deliahu
Last active April 25, 2019 15:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save deliahu/a795c9702cc9e1ce46eb773d61f3abb1 to your computer and use it in GitHub Desktop.
Save deliahu/a795c9702cc9e1ce46eb773d61f3abb1 to your computer and use it in GitHub Desktop.
TensorFlow Serving on Kubernetes
apiVersion: apps/v1
kind: Deployment
metadata:
name: iris
spec:
replicas: 3
selector:
matchLabels:
app: iris-classifier
template:
metadata:
labels:
app: iris-classifier
spec:
initContainers:
- name: download-model
image: busybox
command: ["/bin/sh", "-c"]
args: ["wget -qO- https://s3-us-west-2.amazonaws.com/cortex-blog/tf-serving-k8s/iris.tar.gz | tar xvz -C /models/iris"]
volumeMounts:
- name: model
mountPath: /models/iris
containers:
- name: serving
image: tensorflow/serving
env:
- name: MODEL_NAME
value: iris
ports:
- containerPort: 8501
readinessProbe:
tcpSocket:
port: 8500
volumeMounts:
- name: model
mountPath: /models/iris
volumes:
- name: model
emptyDir: {}
---
apiVersion: v1
kind: Service
metadata:
name: iris
spec:
ports:
- port: 80
targetPort: 8501
selector:
app: iris-classifier
type: LoadBalancer
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment