[Istio Service Mesh] Istio - Getting Started
Getting Started
Istio is the simplify observability, traffic management, security, and policy with the leading service mesh
Istio addresses the challenges developers and operators face with a distributed or microservices architecture. Whether you’re building from scratch or migrating existing applications to cloud native, Istio can help.
This guide lets you quickly evaluate Istio. If you are already familiar with Istio or interested in installing other configuration profiles or advanced deployment models, refer to our which Istio installation method should I use? FAQ page.
Prerequisites
-
Kubernetes (K8s) is an open-source system for automating deployment, scaling, and management of containerized applications.
For more information about installing and using Kubernetes (K8s), see the Kubernetes (K8s) Docs.
Download Istio
-
- Go to the Istio release page to download the installation file for your OS, or download and extract the latest release automatically (Linux or macOS):
1 | curl -L https://istio.io/downloadIstio | sh - |
-
- Move to the Istio package directory. For example, if the package is istio-1.12.1:
1 | cd istio-1.12.1 |
-3 . Add the istioctl client to your path (Linux or macOS):
1 | export PATH=$PWD/bin:$PATH |
Install Istio
-
- For this installation, we use the demo configuration profile. It’s selected to have a good set of defaults for testing, but there are other profiles for production or performance testing.
1 | istioctl install --set profile=demo -y |
-
- Add a namespace label to instruct Istio to automatically inject Envoy sidecar proxies when you deploy your application later:
1 | kubectl label namespace default istio-injection=enabled |
Deploy the sample application
-
- Deploy the Bookinfo sample application:
1 | kubectl apply -f samples/bookinfo/platform/kube/bookinfo.yaml |
-
- The application will start. As each pod becomes ready, the Istio sidecar will be deployed along with it.
1 | kubectl get services |
and
1 | kubectl get pods |
-
- Verify everything is working correctly up to this point. Run this command to see if the app is running inside the cluster and serving HTML pages by checking for the page title in the response:
1 | 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>" |
Open the application to outside traffic
The Bookinfo application is deployed but not accessible from the outside. To make it accessible, you need to create an Istio Ingress Gateway, which maps a path to a route at the edge of your mesh.
Associate this application with the Istio gateway:
1 | kubectl apply -f samples/bookinfo/networking/bookinfo-gateway.yaml |
Ensure that there are no issues with the configuration:
1 | istioctl analyze |
Determining the ingress IP and ports
Follow these instructions to set the INGRESS_HOST
and INGRESS_PORT
variables for accessing the gateway. Use the tabs to choose the instructions for your chosen platform:
Follow these instructions if you have determined that your environment has an external load balancer.
Set the ingress IP and ports:
1 | export INGRESS_HOST=$(kubectl -n istio-system get service istio-ingressgateway -o jsonpath='{.status.loadBalancer.ingress[0].ip}') |
-
- Set GATEWAY_URL:
1 | export GATEWAY_URL=$INGRESS_HOST:$INGRESS_PORT |
-
- Ensure an IP address and port were successfully assigned to the environment variable:
1 | echo "$GATEWAY_URL" |
See Determining the ingress IP and ports | Istio / Getting Started - https://istio.io/latest/docs/setup/getting-started/#determining-the-ingress-ip-and-ports to learn more.
Verify external access
Confirm that the Bookinfo application is accessible from outside by viewing the Bookinfo product page using a browser.
-
- Run the following command to retrieve the external address of the Bookinfo application.
1 | echo "http://$GATEWAY_URL/productpage" |
-
- Paste the output from the previous command into your web browser and confirm that the Bookinfo product page is displayed.
FAQs
iptables-restore: unable to initialize table ‘nat’ where restart pods on CentOS 8
1 | 2021-12-13T06:11:25.560082Z info Running command: iptables-restore --noflush /tmp/iptables-rules-1639375885559926391.txt1504799395 |
Install Istio with components.cni.enabled=true
to resolved it by replacing iptables
with IPVS
.
1 | istioctl install --set components.cni.enabled=true |
See iptables-restore v1.6.1: iptables-restore: unable to initialize table ‘nat’ · Issue #23009 · istio/istio - https://github.com/istio/istio/issues/23009 to learn more.
IST0145: ConflictingGateways - Gateway should not have the same selector, port and matched hosts of server
1 | istioctl analyze |
See Istio / Configuration Analysis Messages - https://istio.io/latest/docs/reference/config/analysis/ to learn more.
References
[1] Istio / Getting Started - https://istio.io/latest/docs/setup/getting-started/
[2] Istio / Install with Istioctl - https://istio.io/latest/docs/setup/install/istioctl/
[3] istio/istio: Connect, secure, control, and observe services. - https://github.com/istio/istio