Deploying Istio to a Kubernetes cluster

Let's create a Kubernetes cluster and install Istio on it.

Make sure you have Helm installed; otherwise, go to https://helm.sh/docs/intro/install/ and install Helm first. The commands are for Helm v3, as follows:

  1. Let's create a Kubernetes cluster on Google Cloud Platform (GCP). Since we already configured the GCP project, we'll use the same and create a cluster directly by executing the following command:
> gcloud container clusters create online-store-istio 
--cluster-version 1.13
--num-nodes 4
--machine-type n1-standard-2

The parameters passed are important; we need at least four nodes in the cluster and a bigger CPU. Once the cluster is created, we need to install Istio on it using Helm. 

  1. Now, let's install Istio locally on our machine. Execute the following commands to fetch Istio:
> cd ~/
> export ISTIO_VERSION=1.3.0
> curl -L https://git.io/getLatestIstio | sh -
# Link the installed version to a generic name
> ln -sf istio-$ISTIO_VERSION istio
> export PATH=~/istio/bin:$PATH
  1. Now, let's create a role binding on our Kubernetes cluster. This is required by Istio:
> kubectl create clusterrolebinding cluster-admin-binding 
--clusterrole=cluster-admin
--user="$(gcloud config get-value core/account)"
  1. Now, we need to create a namespace for Istio so that we can clearly segregate our application from the Istio infrastructure:
> kubectl create namespace istio-system
  1. Now, we can install the Istio custom resource definitions (CRD) using Helm:
> cd ~/istio-$ISTIO_VERSION

# Install the Istio CRDs
> helm template istio-init install/kubernetes/helm/istio-init --namespace istio-system | kubectl apply -f -
  1. Verify all the required CRDs are installed. It should output 23 for this version of Istio:
> kubectl get crds | grep 'istio.io|certmanager.k8s.io' | wc -l
  1. Let's install the Istio components with Helm. We will install the Istio demo setup so that we get Grafana, Jaeger, and Kiali as well. For production, use the Istio default setup. Refer to https://istio.io/docs/setup/kubernetes/install/helm/ to learn more:
> helm template istio install/kubernetes/helm/istio --namespace istio-system 
--values install/kubernetes/helm/istio/values-istio-demo.yaml |
kubectl apply -f -
  1. Wait for the installation to be ready. You can run a watch loop with watch kubectl get pods -n istio-system:

  1. Once everything is in Running status, we can fetch the external IP of the Istio Ingress Gateway by running this command. Copy the IP, as follows:
> kubectl get svc istio-ingressgateway -n istio-system

NAME TYPE CLUSTER-IP EXTERNAL-IP
istio-ingressgateway LoadBalancer 10.7.248.81 34.77.78.2
  1. Now, update this IP in the JDL file we created so that ingressDomain is "34.77.78.2.nip.io".

You can find the final JDL at http://bit.ly/jh-book-istio-jdl.

That is it, we have Istio set up in our Kubernetes cluster. Let's generate our application stack and deploy it.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.12.36.30