Istio is a "Service Mesh" for manage comunication between Microservices inside Kubernetes Core concept of Istio is
- Secure : mTLS between Envoy proxy
- Connect : Canary deployment,Retry policy,Circuit breaker
- Observe : Monitor How traffic is flowing,connection,Response time and Tracing
- Control : Authentication between pod
The main module in Control plane(Istiod) is
- Pilot : Configuration discovery(Automate inject Envoy proxy to pod), Traffic routing Eg. Canary deployment
- Citadel : Certificates management generates certificates to allow secure mTLS communication between Envoy proxy
- Gallary : Configuration(translate Istio CRDs communicate with Envoy proxy)
Ref: https://istio.io/latest/docs/ops/deployment/architecture
- Prerequisites
- Step 1 - Check Kubernetes cluster
- Step 2 - Install istio CLI
- Step 3 - Check istio CLI version
- Step 4 - Check compatability with target cluster
- Step 5 - Check Available istio profile
- Step 6 - Install istio
- Step 7 - Verify installation
- Step 8 - Check istio pod status
- Step 9 - Verify Istio version
- Step 10 - Get an overview of your mesh
- Step 11 - Deploy an example application to default namespace and Installing the Sidecar
- Step 12 - Create ingress rule and genarate some more traffic
- Step 13 - Install Addons
- Step 14 - Seting port-forward to view dashboard
- Reference
- Kubernetes cluster or Kubernetes local development with kind with ingress-nginx.
- Kubernetes client kubectl
- Curl, for testing the examples (backend applications).
kubectl get node
NAME STATUS ROLES AGE VERSION
istio-control-plane Ready control-plane,master 14s v1.23.0
curl -L https://istio.io/downloadIstio | ISTIO_VERSION=1.13.1 TARGET_ARCH=x86_64 sh -
cd istio-1.13.1
export PATH=$PWD/bin:$PATH
This demo we're using Istio version 1.13.1
istioctl version
The output looks similar to the following:
no running Istio pods in "istio-system"
1.13.1
Getting Started : https://istio.io/latest/docs/setup/getting-started/#download
istioctl x precheck
The output looks similar to the following:
✔ No issues found when checking the cluster. Istio is safe to install or upgrade!
To get started, check out https://istio.io/latest/docs/setup/getting-started/
istioctl commands reference : https://istio.io/latest/docs/reference/commands/istioctl/
istioctl profile list
The output looks similar to the following:
default
demo
empty
external
minimal
openshift
preview
remote
Notes:Istio profile
istioctl install --set profile=default
Note : Default This profile is recommended for Production
The output looks similar to the following:
This will install the Istio 1.13.1 default profile with ["Istio core" "Istiod" "Ingress gateways"] components into the cluster. Proceed? (y/N) y
✔ Istio core installed
✔ Istiod installed
✔ Ingress gateways installed
✔ Installation complete
Making this installation the default for injection and validation.
Thank you for installing Istio 1.13. Please take a few minutes to tell us about your install/upgrade experience! https://forms.gle/pzWZpAvMVBecaQ9h9
istioctl verify-install
The output looks similar to the following:
1 Istio control planes detected, checking --revision "default" only
✔ ClusterRole: istiod-istio-system.istio-system checked successfully
✔ ClusterRole: istio-reader-istio-system.istio-system checked successfully
✔ ClusterRoleBinding: istio-reader-istio-system.istio-system checked successfully
✔ ClusterRoleBinding: istiod-istio-system.istio-system checked successfully
✔ ServiceAccount: istio-reader-service-account.istio-system checked successfully
✔ Role: istiod-istio-system.istio-system checked successfully
✔ RoleBinding: istiod-istio-system.istio-system checked successfully
✔ ServiceAccount: istiod-service-account.istio-system checked successfully
✔ CustomResourceDefinition: wasmplugins.extensions.istio.io.istio-system checked successfully
✔ CustomResourceDefinition: destinationrules.networking.istio.io.istio-system checked successfully
✔ CustomResourceDefinition: envoyfilters.networking.istio.io.istio-system checked successfully
✔ CustomResourceDefinition: gateways.networking.istio.io.istio-system checked successfully
✔ CustomResourceDefinition: proxyconfigs.networking.istio.io.istio-system checked successfully
✔ CustomResourceDefinition: serviceentries.networking.istio.io.istio-system checked successfully
✔ CustomResourceDefinition: sidecars.networking.istio.io.istio-system checked successfully
✔ CustomResourceDefinition: virtualservices.networking.istio.io.istio-system checked successfully
✔ CustomResourceDefinition: workloadentries.networking.istio.io.istio-system checked successfully
✔ CustomResourceDefinition: workloadgroups.networking.istio.io.istio-system checked successfully
✔ CustomResourceDefinition: authorizationpolicies.security.istio.io.istio-system checked successfully
✔ CustomResourceDefinition: peerauthentications.security.istio.io.istio-system checked successfully
✔ CustomResourceDefinition: requestauthentications.security.istio.io.istio-system checked successfully
✔ CustomResourceDefinition: telemetries.telemetry.istio.io.istio-system checked successfully
✔ CustomResourceDefinition: istiooperators.install.istio.io.istio-system checked successfully
✔ HorizontalPodAutoscaler: istiod.istio-system checked successfully
✔ ClusterRole: istiod-clusterrole-istio-system.istio-system checked successfully
✔ ClusterRole: istiod-gateway-controller-istio-system.istio-system checked successfully
✔ ClusterRoleBinding: istiod-clusterrole-istio-system.istio-system checked successfully
✔ ClusterRoleBinding: istiod-gateway-controller-istio-system.istio-system checked successfully
✔ ConfigMap: istio.istio-system checked successfully
✔ Deployment: istiod.istio-system checked successfully
✔ ConfigMap: istio-sidecar-injector.istio-system checked successfully
✔ MutatingWebhookConfiguration: istio-sidecar-injector.istio-system checked successfully
✔ PodDisruptionBudget: istiod.istio-system checked successfully
✔ ClusterRole: istio-reader-clusterrole-istio-system.istio-system checked successfully
✔ ClusterRoleBinding: istio-reader-clusterrole-istio-system.istio-system checked successfully
✔ Role: istiod.istio-system checked successfully
✔ RoleBinding: istiod.istio-system checked successfully
✔ Service: istiod.istio-system checked successfully
✔ ServiceAccount: istiod.istio-system checked successfully
✔ EnvoyFilter: stats-filter-1.11.istio-system checked successfully
✔ EnvoyFilter: tcp-stats-filter-1.11.istio-system checked successfully
✔ EnvoyFilter: stats-filter-1.12.istio-system checked successfully
✔ EnvoyFilter: tcp-stats-filter-1.12.istio-system checked successfully
✔ EnvoyFilter: stats-filter-1.13.istio-system checked successfully
✔ EnvoyFilter: tcp-stats-filter-1.13.istio-system checked successfully
✔ ValidatingWebhookConfiguration: istio-validator-istio-system.istio-system checked successfully
✔ HorizontalPodAutoscaler: istio-ingressgateway.istio-system checked successfully
✔ Deployment: istio-ingressgateway.istio-system checked successfully
✔ PodDisruptionBudget: istio-ingressgateway.istio-system checked successfully
✔ Role: istio-ingressgateway-sds.istio-system checked successfully
✔ RoleBinding: istio-ingressgateway-sds.istio-system checked successfully
✔ Service: istio-ingressgateway.istio-system checked successfully
✔ ServiceAccount: istio-ingressgateway-service-account.istio-system checked successfully
Checked 15 custom resource definitions
Checked 2 Istio Deployments
✔ Istio is installed and verified successfully
kubectl get pod -n istio-system
The output looks similar to the following:
NAME READY STATUS RESTARTS AGE
istio-ingressgateway-66ff9c7b6f-f4p6n 1/1 Running 0 16m
istiod-7656645d8c-wrqfq 1/1 Running 0 21m
istioctl version
The output looks similar to the following:
client version: 1.13.1
control plane version: 1.13.1
data plane version: 1.13.1 (1 proxies)
istioctl proxy-status
The output looks similar to the following:
NAME CLUSTER CDS LDS EDS RDS ISTIOD VERSION
istio-ingressgateway-66ff9c7b6f-f4p6n.istio-system Kubernetes SYNCED SYNCED SYNCED NOT SENT istiod-7656645d8c-wrqfq 1.13.1
If a proxy is missing from this list it means that it is not currently connected to a Istiod instance so will not be receiving any configuration.
SYNCED means that Envoy has acknowledged the last configuration Istiod has sent to it.
NOT SENT means that Istiod hasn’t sent anything to Envoy. This usually is because Istiod has nothing to send.
STALE means that Istiod has sent an update to Envoy but has not received an acknowledgement. This usually indicates a networking issue between Envoy and Istiod or a bug with Istio itself.
- Switch to default namespace
kns default
- Deploy example application on default namespace
cd istio-1.13.1
kubectl apply -f samples/bookinfo/platform/kube/bookinfo.yaml
The output looks similar to the following:
service/details created
serviceaccount/bookinfo-details created
deployment.apps/details-v1 created
service/ratings created
serviceaccount/bookinfo-ratings created
deployment.apps/ratings-v1 created
service/reviews created
serviceaccount/bookinfo-reviews created
deployment.apps/reviews-v1 created
deployment.apps/reviews-v2 created
deployment.apps/reviews-v3 created
service/productpage created
serviceaccount/bookinfo-productpage created
deployment.apps/productpage-v1 created
- Check status of pod as you can see all of pod is only 1 container
kubectl get pod
The output looks similar to the following:
NAME READY STATUS RESTARTS AGE
...
details-v1-5498c86cf5-vgwdw 1/1 Running 0 4m43s
productpage-v1-65b75f6885-9c2tj 1/1 Running 0 4m43s
ratings-v1-b477cf6cf-bvrlq 1/1 Running 0 4m43s
reviews-v1-79d546878f-prctw 1/1 Running 0 4m43s
reviews-v2-548c57f459-69989 1/1 Running 0 4m43s
reviews-v3-6dd79655b9-gwp8q 1/1 Running 0 4m43s
- Check anything wrong
istioctl analyze
The output looks similar to the following: It say this namespace not enabled for istio injection let do follow suggestion
Info [IST0102] (Namespace default) The namespace is not enabled for Istio injection. Run 'kubectl label namespace default istio-injection=enabled' to enable it, or 'kubectl label namespace default istio-injection=disabled' to explicitly mark it as not needing injection.
- Install the SideCar(Envoy) to default namespace
kubectl label namespace default istio-injection=enabled
kubectl delete pod --all -n default
The output looks similar to the following:
namespace/default labeled
pod "details-v1-5498c86cf5-6sgd7" deleted
pod "productpage-v1-65b75f6885-xmv2w" deleted
pod "ratings-v1-b477cf6cf-k6f7c" deleted
pod "reviews-v1-79d546878f-nk972" deleted
pod "reviews-v2-548c57f459-w9dvq" deleted
pod "reviews-v3-6dd79655b9-t8mcw" deleted
For Uninstall the Sidecar(Envoy) from default namespace using command :
kubectl label namespace default istio-injection-
kubectl delete pod --all -n default
Installing the Sidecar : https://istio.io/latest/docs/setup/additional-setup/sidecar-injection/
6. Let check our pod again as you can see all of pod have 2 containers that indicate they have sidcars injected to each one of them.
kubectl get pod
The output looks similar to the following:
NAME READY STATUS RESTARTS AGE
details-v1-5498c86cf5-6sgd7 2/2 Running 0 6m16s
productpage-v1-65b75f6885-m8mcf 2/2 Running 0 6m16s
ratings-v1-b477cf6cf-k6f7c 2/2 Running 0 6m16s
reviews-v1-79d546878f-nk972 2/2 Running 0 6m16s
reviews-v2-548c57f459-w9dvq 2/2 Running 0 6m16s
reviews-v3-6dd79655b9-t8mcw 2/2 Running 0 6m15s
- Check anything wrong again
istioctl analyze
The output looks similar to the following:
✔ No validation issues found when analyzing namespace: default.
- Get an overview of your mesh follow Step 9 again
istioctl proxy-status
The output looks similar to the following:
NAME CLUSTER CDS LDS EDS RDS ISTIOD VERSION
details-v1-5498c86cf5-6sgd7.default Kubernetes SYNCED SYNCED SYNCED SYNCED istiod-7656645d8c-wrqfq 1.13.1
istio-ingressgateway-66ff9c7b6f-f4p6n.istio-system Kubernetes SYNCED SYNCED SYNCED NOT SENT istiod-7656645d8c-wrqfq 1.13.1
productpage-v1-65b75f6885-m8mcf.default Kubernetes SYNCED SYNCED SYNCED SYNCED istiod-7656645d8c-wrqfq 1.13.1
ratings-v1-b477cf6cf-k6f7c.default Kubernetes SYNCED SYNCED SYNCED SYNCED istiod-7656645d8c-wrqfq 1.13.1
reviews-v1-79d546878f-nk972.default Kubernetes SYNCED SYNCED SYNCED SYNCED istiod-7656645d8c-wrqfq 1.13.1
reviews-v2-548c57f459-w9dvq.default Kubernetes SYNCED SYNCED SYNCED SYNCED istiod-7656645d8c-wrqfq 1.13.1
reviews-v3-6dd79655b9-t8mcw.default Kubernetes SYNCED SYNCED SYNCED SYNCED istiod-7656645d8c-wrqfq 1.13.1
- Create ingress rule for route traffic to example application
cat <<EOF |kubectl apply -f -
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: bookinfo
namespace: default
spec:
rules:
- http:
paths:
- pathType: Prefix
path: "/productpage"
backend:
service:
name: productpage
port:
number: 9080
- http:
paths:
- pathType: Prefix
path: "/static"
backend:
service:
name: productpage
port:
number: 9080
EOF
- Generate traffic
while sleep 0.1;do curl localhost/productpage &> /dev/null; done
- Install Prometheus & Grafana for Istio
cd istio-1.13.1
kubectl apply -f samples/addons/prometheus.yaml
kubectl apply -f samples/addons/grafana.yaml
kubectl rollout status deploy/grafana -n istio-system
kubectl rollout status deploy/prometheus -n istio-system
The output looks similar to the following:
deployment "grafana" successfully rolled out
deployment "prometheus" successfully rolled out
- Install kiali
kubectl apply -f samples/addons/kiali.yaml
kubectl rollout status deploy/kiali -n istio-system
The output looks similar to the following:
deployment "kiali" successfully rolled out
- Install jaeger
kubectl apply -f samples/addons/jaeger.yaml
kubectl rollout status deploy/jaeger -n istio-system
The output looks similar to the following:
deployment "jaeger" successfully rolled out
- port-forward Grafana
istioctl dashboard grafana
The output looks similar to the following:
http://localhost:3000
- port-forward Kiali
istioctl dashboard kiali
The output looks similar to the following:
http://localhost:20001/kiali
istioctl dashboard jaeger
The output looks similar to the following:
http://localhost:16686