In this hands-on lab, we will be installing Istio into a Docker environment. We’ll deploy an application and using routing rules to version it.
Learning Objectives
Successfully complete this lab by achieving the following learning objectives:
- Install Istio and Its Dependencies for Docker, Then Deploy the bookinfo Application
Add current user to docker group:
sudo usermod -aG docker cloud_user
Install
docker-compose
and make it executable:[cloud_user@host]$ sudo curl -L "https://github.com/docker/compose/releases/download/1.23.2/docker-compose-Linux-x86_64" -o /usr/local/bin/docker-compose [cloud_user@host]$ sudo chmod +x /usr/local/bin/docker-compose
We’ll run
docker-compose
real quick, just to make sure it works before we proceed. We’ll see its help output if all is well.Now we can download Istio and unpack it:
[cloud_user@host]$ wget https://github.com/istio/istio/releases/download/1.0.6/istio-1.0.6-linux.tar.gz [cloud_user@host]$ tar -xvf istio-1.0.6-linux.tar.gz
Pre-configure kubectl for pilot:
[cloud_user@host]$ kubectl config set-context istio --cluster=istio [cloud_user@host]$ kubectl config set-cluster istio --server=http://localhost:8080 [cloud_user@host]$ kubectl config use-context istio
Create a
DOCKER_GATEWAY
environment variable:[cloud_user@host]$ export DOCKER_GATEWAY=172.28.0.1:
Bring up Istio’s control plane:
[cloud_user@host]$ docker-compose -f ./istio-1.0.6/install/consul/istio.yaml up -d
Remember that this may need to be repeated to ensure the pilot container starts.
Change
bookinfo.yaml
, and set port 30080 instead of port 9081:[cloud_user@host]$ sed -i 's/9081/30080/' ./istio-1.0.6/samples/bookinfo/platform/consul/bookinfo.yaml
Bring up the application:
[cloud_user@host]$ docker-compose -f ./istio-1.0.6/samples/bookinfo/platform/consul/bookinfo.yaml up -d
Bring up the sidecars:
[cloud_user@host]$ docker-compose -f ./istio-1.0.6/samples/bookinfo/platform/consul/bookinfo.sidecars.yaml up -d
Point a browser at the public IP address of the server, on the correct port: _http://<PUBLIC_SERVERIP>:30080/productpage.
- Route Application Traffic to reviews Version 1 and Confirm that Version 1 (with No Stars) is Loading
Route traffic to version 1
kubectl apply -f ./istio-1.0.6/samples/bookinfo/platform/consul/destination-rule-all.yaml kubectl apply -f ./istio-1.0.6/samples/bookinfo/platform/consul/virtual-service-all-v1.yaml
- Route the Traffic to Version 3 of the reviews Service (with Red Stars)
We need to modify the routing service subsets to read the labels for Version 3. Edit
istio-1.0.6/samples/bookinfo/platform/consul/virtual-service-all-v1.yaml
(using whatever text editor you like) and change the subset toV3
in the reviews section. Then apply the changes with:[cloud_user@host]$ kubectl apply -f ./istio-1.0.6/samples/bookinfo/platform/consul/virtual-service-all-v1.yaml