thiagodiasb91
11/30/2018 - 2:52 PM

Getting Started

Configurações

Instalando kubectl

sudo apt-get update && sudo apt-get install -y apt-transport-https
curl -s https://packages.cloud.google.com/apt/doc/apt-key.gpg | sudo apt-key add -
echo "deb https://apt.kubernetes.io/ kubernetes-xenial main" | sudo tee -a /etc/apt/sources.list.d/kubernetes.list
sudo apt-get update
sudo apt-get install -y kubectl

Instalando gcloud

gcloud components update
gcloud container clusters create istio-tutorial \
    --machine-type=n1-standard-2 \
    --num-nodes=4 \
    --no-enable-legacy-authorization

Configurando roles do gcloud

kubectl create clusterrolebinding cluster-admin-binding \
>     --clusterrole=cluster-admin \
>     --user=$(gcloud config get-value core/account)
clusterrolebinding "cluster-admin-binding" created

Configurando istio

curl -L https://git.io/getLatestIstio | sh -
export PATH="$PATH:$HOME/istio-x.x.x/bin"

Instalando istio no GCloud Cluster

kubectl apply -f install/kubernetes/istio-demo-auth.yaml     

Verifica instalação do istio

kubectl get service -n istio-system

Deploy

Deploy de um app exemplo com sidecar

kubectl apply -f <(istioctl kube-inject -f samples/bookinfo/platform/kube/bookinfo.yaml)

Configura Gateway

istioctl create -f samples/bookinfo/routing/bookinfo-gateway.yaml

Valida Gateway

   kubectl get gateway
   export INGRESS_HOST=$(kubectl -n istio-system get service istio-ingressgateway -o jsonpath='{.status.loadBalancer.ingress[0].ip}')
   export INGRESS_PORT=$(kubectl -n istio-system get service istio-ingressgateway -o jsonpath='{.spec.ports[?(@.name=="http")].port}')
   export GATEWAY_URL=$INGRESS_HOST:$INGRESS_PORT
   curl -o /dev/null -s -w "%{http_code}\n"
   http://${GATEWAY_URL}/productpage
   200

Expondo Prometheus

Valida prometheus rodando

kubectl -n istio-system get svc prometheus

Port-Forward do Prometheus

kubectl -n istio-system port-forward $(kubectl -n istio-system get pod -l app=prometheus -o jsonpath='{.items[0].metadata.name}') 9090:9090 &

Acesse localhost:9090

Pode ser utilizado para todos os serviços qe estão rodando

Grafana

$ kubectl -n istio-system port-forward $(kubectl -n istio-system get pod -l app=grafana -o jsonpath='{.items[0].metadata.name}') 3000:3000 &

ServiceGraph

$ kubectl -n istio-system port-forward $(kubectl -n istio-system get pod -l app=servicegraph -o jsonpath='{.items[0].metadata.name}') 8088:8088 &

etc...