forked from istio/istio
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add a simple curl source service sample
- Loading branch information
Showing
2 changed files
with
63 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
# Simple sleep service | ||
|
||
This sample consists of a simple service that does nothing but sleep. | ||
It's a ubuntu container with curl installed that can be used as a request source for invoking other services | ||
to experiment with Istio networking. | ||
To use it: | ||
|
||
1. Install Istio by following the [istio install instructions](https://istio.io/docs/tasks/installing-istio.html). | ||
|
||
2. Start the sleep service: | ||
|
||
```bash | ||
kubectl apply -f <(istioctl kube-inject -f sleep.yaml) | ||
``` | ||
|
||
Note that if you also want to be able to directly call | ||
external services, you'll need to set the `--includeIPRanges` option of `kube-inject`. | ||
See [configuring egress](https://istio.io/docs/tasks/egress.html) for details. | ||
|
||
3. Start some other services, for example, the [Bookinfo sample](https://istio.io/docs/samples/bookinfo.html). | ||
|
||
Now you can `kubectl exec` into the sleep service to experiment with Istio. | ||
For example, the following commands can be used curl to call the Bookinfo `ratings` service: | ||
|
||
```bash | ||
$ export SLEEP_POD=$(kubectl describe pod sleep- | awk '$1 == "Name:"{print $2}') | ||
$ kubectl exec -it $SLEEP_POD -c sleep bash | ||
root@sleep-342146846-kbj55:/# curl http://ratings.default.svc.cluster.local:9080/ratings | ||
{"Reviewer1":5,"Reviewer2":4} | ||
root@sleep-342146846-kbj55:/# | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
apiVersion: v1 | ||
kind: Service | ||
metadata: | ||
name: sleep | ||
labels: | ||
app: sleep | ||
spec: | ||
ports: | ||
- port: 80 | ||
name: http | ||
selector: | ||
app: sleep | ||
--- | ||
apiVersion: extensions/v1beta1 | ||
kind: Deployment | ||
metadata: | ||
name: sleep | ||
spec: | ||
replicas: 1 | ||
template: | ||
metadata: | ||
labels: | ||
app: sleep | ||
spec: | ||
containers: | ||
- name: sleep | ||
image: tutum/curl | ||
command: ["/bin/sleep","infinity"] | ||
imagePullPolicy: IfNotPresent | ||
ports: | ||
- containerPort: 80 | ||
--- |