Istio Setup in Kubernetes | Step by Step Guide to install Istio Service Mesh

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
in this video we're gonna learn how to install istio service mesh in a kubernetes cluster first we will install istio core in the cluster the main istio component then we will install istio add-ons for monitoring and tracing after that we will configure our cluster so that estio can automatically inject invoice proxies in our application pods and finally we will deploy an example demo microservices application in the cluster so that we can see all the features and visualization for those microservices in istio and for this demonstration we're going to use a local minicube cluster so let's jump right in now if you want to learn what istio is and what it's used for you can watch my other video about it where i explain what service mesh is and what istio is and all of its use cases and then you can come back and learn the setup of istio in your kubernetes cluster so the first thing we need to do is create or start our mini cube cluster and one note here is that istio will actually need some resources so the default resources that minicube cluster gets created with will not be enough so in the minicube start command we're going to provide options to increase the cpu and memory resources that our minicube cluster gets and this resource configuration should be now enough for our demonstration so make sure to set those resources high and we're gonna start a mini cube cluster so now that we have our mini cube cluster running with enough resources we can actually install issio and the first thing to installing istio is to download istio release package locally on our computer and on istio's official documentation page actually you have a guide to installing istio and in this guide we have link to istio releases you can also download the latest istio release for your specific operating system using this command here but we're going to do this using this istio release link and here you have all the releases we're going to install the latest one and i'm using mac so that's what i'm going to download make sure to download the one for your operating system and as you see this is a tar file so basically we just unpack it or unturn it and we'll see what's inside so what i'm going to do is i'm going to create a folder in my home directory i'm going to call it istio installation and i'm gonna move that downloaded istio tar file to that folder like this and let's go to eastern installation and right here is our tar file so that's the east installation folder and here we have the tar file i'm just gonna double click and unpack it and let's actually see what's inside we have the executable istio binary folder and some other files and what we're going to need from istio is actually an istio control command line which is in this binary folder and we want that command line tool to be executable and right now if i do istio ctl and execute you see command not found so we need that command which is here in the binary folder so in order to make that command available we're gonna add it to a path right to executable path and we can do that by adding the path to this binary folder to our path right basically appending it so right now this is how my path looks like like this and basically here we just want to append the path to this folder here let's actually find out what the path is i'm going to go inside that istio folder like this and i'm going to print out the path that's it this whole thing here and now we can append that to the path variable right so we have the original one the path and separator and we're just gonna add this one here slash bin and there you go i'm going to execute it and now if i do istio ctl and execute there you go so we have istio ctl available or istio control command line interface available here because we set the path now just note that this only sets that path or appends that executable only in this terminal so if i open a new window and try to do istio ctl here you see command not found so it only works wherever you execute this export command so let's close it and there you go we have downloaded istio and now we have istio ctl available and now as a next step we're gonna install istio with this istio ctl command inside our mini cube cluster so first of all i'm gonna do get namespace and let's see that we have just these default namespaces so no istio namespace here and right now also nothing running right so we have an empty cluster and now let's install istio in our cluster and we can do that very easily using istio ctl install command that's it i'm going to execute it and i'm going to confirm it here yes and everything is successfully installed we have istio core then we have istiod which is the main process of istio or main component and ingress gateway so now if i do cube ctl get namespace right here you see istio system namespace got created and let's actually check what's inside there let's print out the pots and there you go we have an istiod pod running here as well as istio ingress gateway now if you already know the istio service mesh architecture you know that we have this istiod component which is a control plane and we have the data plane which are basically the proxies that are injected into application pods right so if you have a micro service application you would have pod for each micro service and then istio would inject proxy and envoy proxy in each of those micro service pods so that means in order to see istio in action and in order to see those invoice proxies we need to deploy an application a micro services application ideally where the proxies will be injected so that's going to be our next step and as an example microservices i have found actually one from google cloud platform microservices demo project and we're going to use this one to deploy that in the cluster and then use istio service mesh for this micro services so in this release folder here you have kubernetes manifests and these are basically kubernetes configuration files for creating deployments and services for a couple of micro services so you can clone this repository and we're going to be using this specific file i have cloned the repo and i have that specific file now in this istio installation folder right here so that i can execute it directly from here so right now i'm inside istio folder and this is my manifests file so obviously this is just kubernetes manifest files so we can do cubectl apply minus f and start our services and they will all start in a default namespace and you see a bunch of them got created we have deployment and service for each one of those and now if i do cubectl getpod again it's in default so directly here you see a list of them and all of them are getting created so we're gonna wait for this one to initialize and start and make this smaller so we can see better and let's do get pod again and there you go all the pods are now running all the micro services and it took actually around eight minutes for all of them to come up and get in the running status so you might have to just wait a little bit for that and also i guess because we are deploying all this in mini cube and because of limited resources it's also a little bit slower so i assume in a bigger cluster this should be a little faster when you're deploying complex microservice applications in kubernetes managing your application data will be challenging however caston who is sponsoring this video has made data management in kubernetes way easier using its k10 data management platform k10 basically takes off most of the load of doing backup and restore in kubernetes from the cluster administrators it has a very simple ui so it's super easy to work with and intelligent logic which does all the heavy lifting for you on top of that casting integrates with all major cloud platforms so you can easily migrate your application from one cluster to another with all of its data and casting does all of that with end-to-end security in mind you can check them out at casting.io now back to our istio setup so now we have our istio core and we have the microservices running as pods now note one thing here that each micro service has one container inside the pod right and you remember i said that istio should actually inject these proxy containers in each of those pots so why don't we have two containers inside each pot or basically why don't we have the proxy containers inside and the reason is because we didn't explicitly tell istio to inject proxies in the application parts and it doesn't work by default right it doesn't inject proxies into every pod that starts in the cluster we actually have to configure that specifically and the configuration for that is actually very simple what we do is basically we label a namespace with a label called istio injection enabled now how do we label namespaces first of all let's actually see the labels that our namespace has and we're deploying our applications or microservice applications in the default namespace so that's the namespace we're going to be labeling so qctl get namespace default and what you can do is show labels and this will give you a list of labels for a namespace and actually you can do this or you can add these show labels option for any other kubernetes component like pods and services etc because all these components can have labels so default namespace has no labels and in order to add the label again very easy we do cubectl label namespace default so name of the namespace basically and finally we define that specific label again it's a key value pair and the key is istio injection and value is enabled so this is something that istio will understand so we have to name this exactly that is to injection enabled let's execute and now if i do get or show labels again for namespace right here you see that label got edit and you can add as many labels as you want to any component so now we can actually shut down all these parts all those micro services and then recreate them to see the proxies being injected so we're going to do cube ctl delete the manifest let's delete all of them if i do cube ctl get pot now i should see all of them terminating and now all the pods are gone we can now just reapply this kubernetes manifests file like this and note here that i have actually not done anything to the existing kubernetes configuration files right all we did is basically just label the namespace and we're doing exactly what we did previously just apply the kubernetes manifest file without any modification there right and that's the great thing about istio that you don't have to reconfigure your existing configuration or the existing kubernetes configuration files for the proxies to get injected and now if i do cube ctl get pod instead of one container per pod you see two containers which are all initializing and this will take some time as well and there you go all the pots are now running and this actually took just two minutes to start this time and again as you see two containers per pot and now i'm actually going to describe one of those parts let's take the first one and in this describe we're going to see the containers in that pot so if we scroll up right here we have init containers is still in it and this is istio proxy image and then in the container section we have our microservices application image itself so basically this part here or the init container got automatically injected in this part by istio because we don't have that container definition inside this kubernetes manifests file so if i open this manifest file and search for it there is no proxy container definition here or init container so this is done by issue automatically so now we have the istio component running in a cluster that automatically injects the invoice proxy container into every pod that we create in a default namespace so we have all that configuration already set up now that's all great but we don't have any data visualization for what's going on in our micro services right so theoretically if you know istio again i explained that all in detail in this what is istio section but istio actually collects the metrics from all these proxy containers so you have all these data about how your microservices are performing what kind of requests they're getting metrics data and so on but we don't see any of this here right and this is where istio add-ons come in and in the istio official documentation you actually see this integrations part and these are add-ons or additional elements that you can install with eco that will give you all this data visualization about the metrics tracing and basically what your micro services are doing and how they are performing so we're going to install some of those add-ons in our cluster now and that is also very simple so in this e-sto folder here where we have this binary for istio control or ctl we have a folder called samples and inside samples we have a folder called add-ons and these are actually just kubernetes configuration files for those services right so the integrations that are listed here for grafana jaeger prometheus etc we have those files or configuration files for those services in that istio installation folder and in order to install them in a cluster we're gonna apply those kubernetes yaml files using cubectl apply command in a cluster very straightforward so again i'm in the istio installation folder so from here i can do cube ctl apply and then in istio 190 i have samples and add-ons and i can apply those files one by one or if i want to apply all the configuration files in the folder i can do it like this so execute and there you go so you see that a bunch of stuff got created we have services deployments config maps etc you actually don't need to understand all those components what's important now is if i let's actually clean this up if i do cube ctl get pod from the istio system namespace where we had two parts running if you remember and now we have grafana jaeger kiali and prometheus parts running or prometheus is starting up let's do it again and there you go so now we have those four add-ons running as pods in istio system and in order to access those parts obviously we need services so let's check that as well istio system and we're going to quickly go through each one of those services that are deployed as istio add-ons in the cluster first we have graffana and prometheus and if you don't know prometheus is used for basically monitoring anything in your cluster this could be the servers itself memory cpu usage as well as kubernetes components themselves like pods and services and all this stuff so this is a monitoring tool and grafana is a data visualization tool for metrics data now if you want to know more details about prometheus and grafana i actually have a separate video on that as well as how to deploy prometheus in your cluster so you can go ahead and check that out if you want to know more as a next one we have jaeger collector and tracing this is actually a service for tracing microservice requests now if you know how microservices application works you basically get a request in your application and then that request goes through multiple microservices right so the request basically gets forwarded multiple times and that creates a chain of requests for one request that a user initiated and tracing service basically helps you trace that whole chain of requests of microservices from one microservice to another and with jager you can then visualize that data right you can see those tracing data for those requests and you can use that to analyze and debug and see where the request basically slows down etc so that's tracing and we also have zipkin here which actually is an alternative to jager right so in your cluster when you deploy istio add-ons you should have just one of those two and the reason why we have a zip key in here as well is because in this addons folder we have grafana jaeger kiali prometheus but we also have this extras folder which contains the zipkin yaml file right so that one also got deployed because it's also a kubernetes configuration file so we have it here as well as we have prometheus operator yaml file in this extras folder which basically is configuration to monitor the easter components themselves with prometheus and for this to work you actually have to have prometheus operator already installed in your cluster which we don't have in our cluster now again if you want to know the difference between prometheus operator and this prometheus or what grafana is i have own video about that that explains all these in detail so you can go watch that and finally we have a service here called kiali which is actually my favorite service for working with microservices because it has an amazing data visualization features as well as features to actually configure your services setup and communication so we're going to take a quick look on kiali and how it looks and basically we have all types of visualization including the monitoring data in the tracing data because it's so cool actually we're going to take a very quick look at kiali specifically in our demo in order to access kiali we need access to its service so i'm gonna do cube ctl port forward and this is a service kiali in an istio system namespace and as a final parameter for port forward we need the port of that service so this will configure port forwarding for this internal service which we can't access from outside so i will be able to access it locally localhost on this port so let's execute and that's the address and let's open it here and there you go this is actually kiali dashboard or view and we have default namespace and istio system namespace and we have 12 applications running in a default namespace and these are actually our microservice applications and if i click inside here i switch to applications and i see basically some data about the applications but the coolest feature or part is the graph here if i load this graph so actually make the graph bigger and right here you see the network of our microservices visualized in this form and kali overview and how it works could actually be its own video but just to give you a very quick idea you see that just by looking at this graph even if you have no idea about how those micro services are implemented you actually see how they communicate with each other which microservice talks to which one and so on and in the service graph basically you see these are kubernetes services basically that are interconnected so you see frontend talks to the recommendation service which talks to product catalog service etc and then per application as i mentioned you have metrics and traces and everything also in one place in kiali so you have the traffic inbound metrics traces etc again there there is much more to kiyali which could be its own video but you can definitely just play around with it and check out some features but there's just one final thing that i want to mention about istio configuration and how all of this actually works i mentioned that for istio configuration you actually don't need to adjust anything in your kubernetes configuration files but there's actually one thing that you need to do or you need to have in your manifest files for your deployments and services for this graph here to work or this display here to work and that is a label called app right right here you see label f and name of the microservice and if i search for it you see all the occurrences we have them in services and deployments and app label actually has a special meaning in istio so whenever you're deploying your microservices in istio enabled cluster you actually have to have this app label on your deployments and services for the data visualization to work i mean the pods will still deploy you will not have any errors but the visualization will not work like this right and as you see here the names at service front end these actually are the values of app label here and in the applications tab also as you see we have for each application these are the deployments basically you have these app label so that's how istio basically knows how to visualize your application graph and the communication like this so that's the one thing you would probably need to adjust in your kubernetes configuration files so that's how you install istio in your cluster how you deploy additional add-ons in order to visualize metrics data and communication data between your microservices and how to configure your cluster for istio proxy injection thank you for watching and see you in the next video
Info
Channel: TechWorld with Nana
Views: 66,953
Rating: undefined out of 5
Keywords: istio, service mesh, service mesh istio, istio setup, istio setup in kubernetes, istio tutorial, istio install, istio installation on kubernetes, istio install kiali, install istio, install istio on kubernetes cluster, install istio in kubernetes, install istio on minikube, istioctl, techworld with nana, kubernetes service mesh, service mesh kubernetes, how to install istio, how to install istio on kubernetes, istio installation, istio installation guide, microservices
Id: voAyroDb6xk
Channel Id: undefined
Length: 27min 26sec (1646 seconds)
Published: Fri Feb 26 2021
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.