Getting Started with Istio and Minikube

Istio is the new standard for microservices in Kubernetes. Around 2014 Netflix defined before everybody else how to do proper microservices using they brand new stack called NetflixOSS. Introducing game-changing concepts for the Cloud Native microservice components such as Mid-tier load balancing, fault tolerance, circuit breaking, retry/timeouts, service registry and discoverability and much more. NetflixOSS was super important and still is in the cloud-native microservices world. Today the great majority of companies who do Java development use



NetflixOSS Stack directly or via Spring Cloud Abstractions. IMHO the main benefit Spring Cloud added was documentation. Today several NetflixOSS components are deprecated or like how Netflix like to call it MANTAINCE_MODE you can check that in any NetflixOSS project on Github by looking the file OSSMETADATA. As you can see here Hystrix is in mantaince mode. One of the reasons is because there is a better way to deal with the problem, for Hystrix there are adaptive thresholds but also because the world is changing fast. Today in 2019 Kubernetes makes more sense them ever as becoming the true multi-poly cloud solution. Kubernetes with Istio(using Envoy) fix some of the problems of the NetflixOSS Stack such as being binary coupled and very hard to work without java. Today I will show a quick DEMO on how to run istio in Minikube(local env) and also a quick presentation on some k8s and istio concepts. Hoje you All enjoy.

Why Istio?

Basically, all that the NetflixOSS stack for microservices was doing was moved to the platform and outside of your classpath. So this means Kubernetes, Istio, and Envoy are doing all the heavy lifting for you. Also, you still have the same cloud-native game-changing capabilities but now you are free to use any language, any server, any architecture as long and you pack your image with Docker. This pattern introduces greater flexibility to the developer and you still benefit from kubernetes abstractions meaning your code easily run multi-cloud.
Istio Slide Deck



Istio Video presentation + DEMO



Installing Istio on Minikube(gist)

Download Install: Kubectl(1.13.0)

curl -LO https://storage.googleapis.com/kubernetes-release/release/v1.13.0/bin/linux/amd64/kubectl
chmod +x ./kubectl
sudo mv ./kubectl /usr/local/bin/kubectl

Install Minikube(0.33.1)

curl -Lo minikube https://storage.googleapis.com/minikube/releases/latest/minikube-linux-amd64 \
  && chmod +x minikube
sudo cp minikube /usr/local/bin && rm minikube  

minikube start --memory=8192 --cpus=4 --kubernetes-version=v1.10.0 \
    --extra-config=controller-manager.cluster-signing-cert-file="/var/lib/localkube/certs/ca.crt" \
    --extra-config=controller-manager.cluster-signing-key-file="/var/lib/localkube/certs/ca.key" \
    --vm-driver='virtualbox'

Install Helm(2.12.1)

wget https://storage.googleapis.com/kubernetes-helm/helm-v2.12.1-linux-amd64.tar.gz
tar -xzvf helm-v2.12.1-linux-amd64.tar.gz
chmod +x linux-amd64/helm
mv linux-amd64/helm /usr/local/bin/helm

Download Istio(1.0.5)

git clone https://github.com/istio/istio.git
cd istio/
git checkout tags/1.0.5
sudo cp bin/istioctl /usr/local/bin

Install Istio(1.0.5)

helm template install/kubernetes/helm/istio --name istio --namespace istio-system > $HOME/istio.yaml
kubectl create namespace istio-system
kubectl apply -f $HOME/istio.yaml
kubectl get pods -n istio-system

Run Bookinfo App

cd istio/
kubectl apply -f <(istioctl kube-inject -f samples/bookinfo/platform/kube/bookinfo.yaml)
kubectl get services
kubectl get pods
## You need to wait to have all pods running this take some time
kubectl apply -f samples/bookinfo/networking/bookinfo-gateway.yaml
kubectl get gateway

Testing the App

# URL will be something like: 192.168.99.100:31380/productpage 
URL="http://$(minikube ip):$(kubectl -n istio-system get service istio-ingressgateway -o jsonpath='{.spec.ports[?(@.port==80)].nodePort}')/productpage"
curl -o /dev/null -s -w "%{http_code}\n" $URL
xdg-open $URL

Install Kiali

bash <(curl -L http://git.io/getLatestKialiKubernetes)
xdg-open "https://$(minikube ip):$(kubectl -n istio-system get service kiali -o jsonpath='{.spec.ports[?(@.port==20001)].nodePort}')/kiali/console"

Accessing Prometheus

kubectl -n istio-system port-forward $(kubectl -n istio-system get pod -l app=prometheus -o jsonpath='{.items[0].metadata.name}') 9090:9090
xdg-open http://localhost:9090/graph?g0.range_input=1h&g0.expr=istio_request_bytes_count&g0.tab=0

Thatś it guys. I will be posting more about Kubernetes and Istio soon. I hope you enjoy and take care.

cheers,
Diego Pacheco

Popular posts from this blog

Having fun with Zig Language

C Unit Testing with Check

Cool Retro Terminal