mirror of https://github.com/istio/istio.io.git
Remove manual injection step from Bookinfo etc (#15514)
* Remove manual injection step from Bookinfo etc * Fix tests with new snip locations
This commit is contained in:
parent
af56db4727
commit
d8e59bb520
|
|
@ -92,17 +92,6 @@ If you use GKE, please ensure your cluster has at least 4 standard GKE nodes. If
|
||||||
$ kubectl apply -f @samples/bookinfo/platform/kube/bookinfo.yaml@
|
$ kubectl apply -f @samples/bookinfo/platform/kube/bookinfo.yaml@
|
||||||
{{< /text >}}
|
{{< /text >}}
|
||||||
|
|
||||||
{{< warning >}}
|
|
||||||
If you disabled automatic sidecar injection during installation and rely on [manual sidecar injection](/docs/setup/additional-setup/sidecar-injection/#manual-sidecar-injection),
|
|
||||||
use the [`istioctl kube-inject`](/docs/reference/commands/istioctl/#istioctl-kube-inject) command to modify the `bookinfo.yaml`
|
|
||||||
file before deploying your application.
|
|
||||||
|
|
||||||
{{< text bash >}}
|
|
||||||
$ kubectl apply -f <(istioctl kube-inject -f @samples/bookinfo/platform/kube/bookinfo.yaml@)
|
|
||||||
{{< /text >}}
|
|
||||||
|
|
||||||
{{< /warning >}}
|
|
||||||
|
|
||||||
The command launches all four services shown in the `bookinfo` application architecture diagram.
|
The command launches all four services shown in the `bookinfo` application architecture diagram.
|
||||||
All 3 versions of the reviews service, v1, v2, and v3, are started.
|
All 3 versions of the reviews service, v1, v2, and v3, are started.
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -30,14 +30,10 @@ kubectl apply -f samples/bookinfo/platform/kube/bookinfo.yaml
|
||||||
}
|
}
|
||||||
|
|
||||||
snip_start_the_application_services_3() {
|
snip_start_the_application_services_3() {
|
||||||
kubectl apply -f <(istioctl kube-inject -f samples/bookinfo/platform/kube/bookinfo.yaml)
|
|
||||||
}
|
|
||||||
|
|
||||||
snip_start_the_application_services_4() {
|
|
||||||
kubectl get services
|
kubectl get services
|
||||||
}
|
}
|
||||||
|
|
||||||
! IFS=$'\n' read -r -d '' snip_start_the_application_services_4_out <<\ENDSNIP
|
! IFS=$'\n' read -r -d '' snip_start_the_application_services_3_out <<\ENDSNIP
|
||||||
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
|
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
|
||||||
details ClusterIP 10.0.0.31 <none> 9080/TCP 6m
|
details ClusterIP 10.0.0.31 <none> 9080/TCP 6m
|
||||||
kubernetes ClusterIP 10.0.0.1 <none> 443/TCP 7d
|
kubernetes ClusterIP 10.0.0.1 <none> 443/TCP 7d
|
||||||
|
|
@ -46,11 +42,11 @@ ratings ClusterIP 10.0.0.15 <none> 9080/TCP 6m
|
||||||
reviews ClusterIP 10.0.0.170 <none> 9080/TCP 6m
|
reviews ClusterIP 10.0.0.170 <none> 9080/TCP 6m
|
||||||
ENDSNIP
|
ENDSNIP
|
||||||
|
|
||||||
snip_start_the_application_services_5() {
|
snip_start_the_application_services_4() {
|
||||||
kubectl get pods
|
kubectl get pods
|
||||||
}
|
}
|
||||||
|
|
||||||
! IFS=$'\n' read -r -d '' snip_start_the_application_services_5_out <<\ENDSNIP
|
! IFS=$'\n' read -r -d '' snip_start_the_application_services_4_out <<\ENDSNIP
|
||||||
NAME READY STATUS RESTARTS AGE
|
NAME READY STATUS RESTARTS AGE
|
||||||
details-v1-1520924117-48z17 2/2 Running 0 6m
|
details-v1-1520924117-48z17 2/2 Running 0 6m
|
||||||
productpage-v1-560495357-jk1lz 2/2 Running 0 6m
|
productpage-v1-560495357-jk1lz 2/2 Running 0 6m
|
||||||
|
|
@ -60,11 +56,11 @@ reviews-v2-1343845940-b34q5 2/2 Running 0 6m
|
||||||
reviews-v3-1813607990-8ch52 2/2 Running 0 6m
|
reviews-v3-1813607990-8ch52 2/2 Running 0 6m
|
||||||
ENDSNIP
|
ENDSNIP
|
||||||
|
|
||||||
snip_start_the_application_services_6() {
|
snip_start_the_application_services_5() {
|
||||||
kubectl exec "$(kubectl get pod -l app=ratings -o jsonpath='{.items[0].metadata.name}')" -c ratings -- curl -sS productpage:9080/productpage | grep -o "<title>.*</title>"
|
kubectl exec "$(kubectl get pod -l app=ratings -o jsonpath='{.items[0].metadata.name}')" -c ratings -- curl -sS productpage:9080/productpage | grep -o "<title>.*</title>"
|
||||||
}
|
}
|
||||||
|
|
||||||
! IFS=$'\n' read -r -d '' snip_start_the_application_services_6_out <<\ENDSNIP
|
! IFS=$'\n' read -r -d '' snip_start_the_application_services_5_out <<\ENDSNIP
|
||||||
<title>Simple Bookstore App</title>
|
<title>Simple Bookstore App</title>
|
||||||
ENDSNIP
|
ENDSNIP
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -32,15 +32,15 @@ snip_start_the_application_services_1
|
||||||
|
|
||||||
snip_start_the_application_services_2
|
snip_start_the_application_services_2
|
||||||
|
|
||||||
_verify_like snip_start_the_application_services_4 "$snip_start_the_application_services_4_out"
|
_verify_like snip_start_the_application_services_3 "$snip_start_the_application_services_3_out"
|
||||||
|
|
||||||
for deploy in "productpage-v1" "details-v1" "ratings-v1" "reviews-v1" "reviews-v2" "reviews-v3"; do
|
for deploy in "productpage-v1" "details-v1" "ratings-v1" "reviews-v1" "reviews-v2" "reviews-v3"; do
|
||||||
_wait_for_deployment default "$deploy"
|
_wait_for_deployment default "$deploy"
|
||||||
done
|
done
|
||||||
|
|
||||||
_verify_like snip_start_the_application_services_5 "$snip_start_the_application_services_5_out"
|
_verify_like snip_start_the_application_services_4 "$snip_start_the_application_services_4_out"
|
||||||
|
|
||||||
_verify_contains snip_start_the_application_services_6 "$snip_start_the_application_services_6_out"
|
_verify_contains snip_start_the_application_services_5 "$snip_start_the_application_services_5_out"
|
||||||
|
|
||||||
if [ "$GATEWAY_API" == "true" ]; then
|
if [ "$GATEWAY_API" == "true" ]; then
|
||||||
_verify_like snip_determine_the_ingress_ip_and_port_3 "$snip_determine_the_ingress_ip_and_port_3_out"
|
_verify_like snip_determine_the_ingress_ip_and_port_3 "$snip_determine_the_ingress_ip_and_port_3_out"
|
||||||
|
|
|
||||||
|
|
@ -1,9 +1,7 @@
|
||||||
---
|
---
|
||||||
title: Enable Istio on productpage
|
title: Enable Istio on productpage
|
||||||
overview: Deploy the Istio control plane and enable Istio on a single microservice.
|
overview: Deploy the Istio control plane and enable Istio on a single microservice.
|
||||||
|
|
||||||
weight: 60
|
weight: 60
|
||||||
|
|
||||||
owner: istio/wg-docs-maintainers
|
owner: istio/wg-docs-maintainers
|
||||||
test: no
|
test: no
|
||||||
---
|
---
|
||||||
|
|
@ -26,8 +24,8 @@ disrupt your application, it continues to run and serve user requests.
|
||||||
1. Redeploy the `productpage` microservice, Istio-enabled:
|
1. Redeploy the `productpage` microservice, Istio-enabled:
|
||||||
|
|
||||||
{{< tip >}}
|
{{< tip >}}
|
||||||
This tutorial step demonstrates manual sidecar injection to enable Istio for instructional purposes,
|
This tutorial step demonstrates manual sidecar injection to demonstrate enabling Istio service-by-service for instructional purposes.
|
||||||
however [Automatic sidecar injection](/docs/setup/additional-setup/sidecar-injection/#automatic-sidecar-injection) is more convenient.
|
[Automatic sidecar injection](/docs/setup/additional-setup/sidecar-injection/#automatic-sidecar-injection) is the recommended method for production use.
|
||||||
{{< /tip >}}
|
{{< /tip >}}
|
||||||
|
|
||||||
{{< text bash >}}
|
{{< text bash >}}
|
||||||
|
|
|
||||||
|
|
@ -31,41 +31,20 @@ example configuration and commands.
|
||||||
|
|
||||||
1. Install `v2` of the `ratings` service.
|
1. Install `v2` of the `ratings` service.
|
||||||
|
|
||||||
If you are using a cluster with automatic sidecar injection enabled,
|
|
||||||
deploy the services using `kubectl`:
|
|
||||||
|
|
||||||
{{< text bash >}}
|
{{< text bash >}}
|
||||||
$ kubectl apply -f @samples/bookinfo/platform/kube/bookinfo-ratings-v2.yaml@
|
$ kubectl apply -f @samples/bookinfo/platform/kube/bookinfo-ratings-v2.yaml@
|
||||||
serviceaccount/bookinfo-ratings-v2 created
|
serviceaccount/bookinfo-ratings-v2 created
|
||||||
deployment.apps/ratings-v2 created
|
deployment.apps/ratings-v2 created
|
||||||
{{< /text >}}
|
{{< /text >}}
|
||||||
|
|
||||||
If you are using manual sidecar injection, run the following command instead:
|
|
||||||
|
|
||||||
{{< text bash >}}
|
|
||||||
$ kubectl apply -f <(istioctl kube-inject -f @samples/bookinfo/platform/kube/bookinfo-ratings-v2.yaml@)
|
|
||||||
deployment "ratings-v2" configured
|
|
||||||
{{< /text >}}
|
|
||||||
|
|
||||||
1. Install the `mongodb` service:
|
1. Install the `mongodb` service:
|
||||||
|
|
||||||
If you are using a cluster with automatic sidecar injection enabled,
|
|
||||||
deploy the services using `kubectl`:
|
|
||||||
|
|
||||||
{{< text bash >}}
|
{{< text bash >}}
|
||||||
$ kubectl apply -f @samples/bookinfo/platform/kube/bookinfo-db.yaml@
|
$ kubectl apply -f @samples/bookinfo/platform/kube/bookinfo-db.yaml@
|
||||||
service/mongodb created
|
service/mongodb created
|
||||||
deployment.apps/mongodb-v1 created
|
deployment.apps/mongodb-v1 created
|
||||||
{{< /text >}}
|
{{< /text >}}
|
||||||
|
|
||||||
If you are using manual sidecar injection, run the following command instead:
|
|
||||||
|
|
||||||
{{< text bash >}}
|
|
||||||
$ kubectl apply -f <(istioctl kube-inject -f @samples/bookinfo/platform/kube/bookinfo-db.yaml@)
|
|
||||||
service "mongodb" configured
|
|
||||||
deployment "mongodb-v1" configured
|
|
||||||
{{< /text >}}
|
|
||||||
|
|
||||||
1. The Bookinfo sample deploys multiple versions of each microservice, so begin by creating destination rules
|
1. The Bookinfo sample deploys multiple versions of each microservice, so begin by creating destination rules
|
||||||
that define the service subsets corresponding to each version, and the load balancing policy for each subset.
|
that define the service subsets corresponding to each version, and the load balancing policy for each subset.
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -30,61 +30,44 @@ deployment.apps/ratings-v2 created
|
||||||
ENDSNIP
|
ENDSNIP
|
||||||
|
|
||||||
snip_collecting_new_telemetry_data_2() {
|
snip_collecting_new_telemetry_data_2() {
|
||||||
kubectl apply -f <(istioctl kube-inject -f samples/bookinfo/platform/kube/bookinfo-ratings-v2.yaml)
|
|
||||||
}
|
|
||||||
|
|
||||||
! IFS=$'\n' read -r -d '' snip_collecting_new_telemetry_data_2_out <<\ENDSNIP
|
|
||||||
deployment "ratings-v2" configured
|
|
||||||
ENDSNIP
|
|
||||||
|
|
||||||
snip_collecting_new_telemetry_data_3() {
|
|
||||||
kubectl apply -f samples/bookinfo/platform/kube/bookinfo-db.yaml
|
kubectl apply -f samples/bookinfo/platform/kube/bookinfo-db.yaml
|
||||||
}
|
}
|
||||||
|
|
||||||
! IFS=$'\n' read -r -d '' snip_collecting_new_telemetry_data_3_out <<\ENDSNIP
|
! IFS=$'\n' read -r -d '' snip_collecting_new_telemetry_data_2_out <<\ENDSNIP
|
||||||
service/mongodb created
|
service/mongodb created
|
||||||
deployment.apps/mongodb-v1 created
|
deployment.apps/mongodb-v1 created
|
||||||
ENDSNIP
|
ENDSNIP
|
||||||
|
|
||||||
snip_collecting_new_telemetry_data_4() {
|
snip_collecting_new_telemetry_data_3() {
|
||||||
kubectl apply -f <(istioctl kube-inject -f samples/bookinfo/platform/kube/bookinfo-db.yaml)
|
|
||||||
}
|
|
||||||
|
|
||||||
! IFS=$'\n' read -r -d '' snip_collecting_new_telemetry_data_4_out <<\ENDSNIP
|
|
||||||
service "mongodb" configured
|
|
||||||
deployment "mongodb-v1" configured
|
|
||||||
ENDSNIP
|
|
||||||
|
|
||||||
snip_collecting_new_telemetry_data_5() {
|
|
||||||
kubectl apply -f samples/bookinfo/networking/destination-rule-all.yaml
|
kubectl apply -f samples/bookinfo/networking/destination-rule-all.yaml
|
||||||
}
|
}
|
||||||
|
|
||||||
snip_collecting_new_telemetry_data_6() {
|
snip_collecting_new_telemetry_data_4() {
|
||||||
kubectl apply -f samples/bookinfo/networking/destination-rule-all-mtls.yaml
|
kubectl apply -f samples/bookinfo/networking/destination-rule-all-mtls.yaml
|
||||||
}
|
}
|
||||||
|
|
||||||
snip_collecting_new_telemetry_data_7() {
|
snip_collecting_new_telemetry_data_5() {
|
||||||
kubectl get destinationrules -o yaml
|
kubectl get destinationrules -o yaml
|
||||||
}
|
}
|
||||||
|
|
||||||
snip_collecting_new_telemetry_data_8() {
|
snip_collecting_new_telemetry_data_6() {
|
||||||
kubectl apply -f samples/bookinfo/networking/virtual-service-ratings-db.yaml
|
kubectl apply -f samples/bookinfo/networking/virtual-service-ratings-db.yaml
|
||||||
}
|
}
|
||||||
|
|
||||||
! IFS=$'\n' read -r -d '' snip_collecting_new_telemetry_data_8_out <<\ENDSNIP
|
! IFS=$'\n' read -r -d '' snip_collecting_new_telemetry_data_6_out <<\ENDSNIP
|
||||||
virtualservice.networking.istio.io/reviews created
|
virtualservice.networking.istio.io/reviews created
|
||||||
virtualservice.networking.istio.io/ratings created
|
virtualservice.networking.istio.io/ratings created
|
||||||
ENDSNIP
|
ENDSNIP
|
||||||
|
|
||||||
snip_collecting_new_telemetry_data_9() {
|
snip_collecting_new_telemetry_data_7() {
|
||||||
curl http://"$GATEWAY_URL/productpage"
|
curl http://"$GATEWAY_URL/productpage"
|
||||||
}
|
}
|
||||||
|
|
||||||
snip_collecting_new_telemetry_data_10() {
|
snip_collecting_new_telemetry_data_8() {
|
||||||
istioctl dashboard prometheus
|
istioctl dashboard prometheus
|
||||||
}
|
}
|
||||||
|
|
||||||
! IFS=$'\n' read -r -d '' snip_collecting_new_telemetry_data_11 <<\ENDSNIP
|
! IFS=$'\n' read -r -d '' snip_collecting_new_telemetry_data_9 <<\ENDSNIP
|
||||||
istio_tcp_connections_opened_total{
|
istio_tcp_connections_opened_total{
|
||||||
destination_version="v1",
|
destination_version="v1",
|
||||||
instance="172.17.0.18:42422",
|
instance="172.17.0.18:42422",
|
||||||
|
|
@ -93,7 +76,7 @@ canonical_service_name="ratings-v2",
|
||||||
canonical_service_revision="v2"}
|
canonical_service_revision="v2"}
|
||||||
ENDSNIP
|
ENDSNIP
|
||||||
|
|
||||||
! IFS=$'\n' read -r -d '' snip_collecting_new_telemetry_data_12 <<\ENDSNIP
|
! IFS=$'\n' read -r -d '' snip_collecting_new_telemetry_data_10 <<\ENDSNIP
|
||||||
istio_tcp_connections_closed_total{
|
istio_tcp_connections_closed_total{
|
||||||
destination_version="v1",
|
destination_version="v1",
|
||||||
instance="172.17.0.18:42422",
|
instance="172.17.0.18:42422",
|
||||||
|
|
|
||||||
|
|
@ -38,15 +38,15 @@ _wait_for_deployment istio-system prometheus
|
||||||
_verify_same snip_collecting_new_telemetry_data_1 "$snip_collecting_new_telemetry_data_1_out"
|
_verify_same snip_collecting_new_telemetry_data_1 "$snip_collecting_new_telemetry_data_1_out"
|
||||||
|
|
||||||
# Install the MongoDB service
|
# Install the MongoDB service
|
||||||
_verify_same snip_collecting_new_telemetry_data_3 "$snip_collecting_new_telemetry_data_3_out"
|
_verify_same snip_collecting_new_telemetry_data_2 "$snip_collecting_new_telemetry_data_2_out"
|
||||||
|
|
||||||
# Apply the destination rules
|
# Apply the destination rules
|
||||||
snip_collecting_new_telemetry_data_5
|
snip_collecting_new_telemetry_data_3
|
||||||
_wait_for_istio destinationrule default ratings
|
_wait_for_istio destinationrule default ratings
|
||||||
_wait_for_istio destinationrule default reviews
|
_wait_for_istio destinationrule default reviews
|
||||||
|
|
||||||
# Create the virtual services
|
# Create the virtual services
|
||||||
_verify_same snip_collecting_new_telemetry_data_8 "$snip_collecting_new_telemetry_data_8_out"
|
_verify_same snip_collecting_new_telemetry_data_6 "$snip_collecting_new_telemetry_data_6_out"
|
||||||
_wait_for_istio virtualservice default reviews
|
_wait_for_istio virtualservice default reviews
|
||||||
_wait_for_istio virtualservice default ratings
|
_wait_for_istio virtualservice default ratings
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue