Skip to content

Commit

Permalink
tensorflow canary example (kubeflow#132)
Browse files Browse the repository at this point in the history
Adds a tensorflow canary example
  • Loading branch information
animeshsingh authored and ellistarn committed Jun 4, 2019
1 parent 3c5219f commit 7fa65e0
Show file tree
Hide file tree
Showing 7 changed files with 115 additions and 2 deletions.
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,6 @@ In the future, we hope to support more advanced use cases such as outlier detect

This project is an evolution of the [original proposal in the Kubeflow repo](https://github.com/kubeflow/kubeflow/issues/2306). To know more about KFServing, please [read the docs](/docs)

For developers looking to contribute, please [follow this doc](/docs/DEVELOPER_GUIDE.md).
For developers looking to contribute, please [follow this doc](/docs/DEVELOPER_GUIDE.md).

![KFServing](./docs/diagrams/kfserving.png)
45 changes: 45 additions & 0 deletions docs/DEVELOPER_GUIDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,51 @@ controller is simply:
make deploy-dev
```

### Knative CLI (knctl):

You can also use [Knative CLI (`knctl`)](https://github.com/cppforlife/knctl) to interact with models deployed on KFServing. It provides a simple set of commands to interact with a [Knative installation](https://github.com/knative/docs). You can grab pre-built binaries from the [Releases page](https://github.com/cppforlife/knctl/releases). Once downloaded, you can run the following commands to get it working.

```
# compare checksum output to what's included in the release notes
$ shasum -a 265 ~/Downloads/knctl-*
# move binary to your system’s /usr/local/bin -- might require root password
$ mv ~/Downloads/knctl-* /usr/local/bin/knctl
# make the newly copied file executable -- might require root password
$ chmod +x /usr/local/bin/knctl
```

You can then run a smoke test by running the following command to show the details of tensorflow sample revision.

```
knctl revision show -r flowers-sample-default-4s74r
Revision 'flowers-sample-default-4s74r'
Name flowers-sample-default-4s74r
Tags -
Image digest index.docker.io/tensorflow/serving@sha256:df3c6fe1fbe5ccc3a916984ff313cc2d17e617f7b8782fc31e762c491325d813
Log URL http://localhost:8001/api/v1/namespaces/knative-monitoring/services/kibana-logging/proxy/app/kibana#/discover?_a=(query:(match:(kubernetes.labels.knative-dev%2FrevisionUID:(query:'1135797e-8585-11e9-adbd-b680f8334647',type:phrase))))
Annotations autoscaling.knative.dev/class: kpa.autoscaling.knative.dev
autoscaling.knative.dev/target: "1"
Age 1h
Conditions
Type Status Age Reason Message
Active False 59m NoTraffic The target is not receiving traffic.
BuildSucceeded True 1h - -
ContainerHealthy True 1h - -
Ready True 1h - -
ResourcesAvailable True 1h - -
Pods conditions
Pod Type Status Age Reason Message
Succeeded
```

## Troubleshooting

1. When you run make deploy, you may encounter an error like this:
Expand Down
Binary file added docs/diagrams/kfserving.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
54 changes: 53 additions & 1 deletion docs/samples/tensorflow/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,4 +57,56 @@ Expected Output
]
* Connection #0 to host 34.83.190.188 left intact
}%
```
```

If you stop making requests to the application, you should eventually see that your application scales itself back down to zero. Watch the pod until you see that it is `Terminating`. This should take approximately 90 seconds.

```
kubectl get pods --watch
```

Note: To exit the watch, use `ctrl + c`.

## Canary Rollout

To test a canary rollout, you can use the tensorflow-canary.yaml

Apply the CRD
```
kubectl apply -f tensorflow-canary.yaml
```

To verify if your traffic split percenage is applied correctly, you can use the following command:

```
kubectl get kfservices
NAME URL DEFAULT TRAFFIC CANARY TRAFFIC AGE
flowers-sample flowers-sample.default.example.com 90 10 48s
```

If you are using the [Knative CLI (knctl)](#knative-cli), run the following command

```
knctl route show --route flowers-sample
Route 'flowers-sample'
Name flowers-sample
Domain flowers-sample.default.example.com
Internal Domain flowers-sample.default.svc.cluster.local
Age 1m
Targets
Percent Revision Service Domain
90% flowers-sample-default-4s74r - flowers-sample.default.example.com
10% flowers-sample-canary-bjdkm - flowers-sample.default.example.com
Conditions
Type Status Age Reason Message
AllTrafficAssigned True 46s - -
IngressReady True 45s - -
Ready True 45s - -
Succeeded
```
14 changes: 14 additions & 0 deletions docs/samples/tensorflow/tensorflow-canary.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
apiVersion: "serving.kubeflow.org/v1alpha1"
kind: "KFService"
metadata:
name: "flowers-sample"
spec:
default:
# 90% of traffic is sent to this model
tensorflow:
modelUri: "gs://kfserving-samples/models/tensorflow/flowers"
canaryTrafficPercent: 10
canary:
# 10% of traffic is sent to this model
tensorflow:
modelUri: "gs://kfserving-samples/models/tensorflow/flowers-2"
Binary file removed python/sklearnserver/model.joblib
Binary file not shown.
Binary file removed python/xgbserver/model.bst
Binary file not shown.

0 comments on commit 7fa65e0

Please sign in to comment.