Kubernetes command-line tools(kubectl) que permite executar comandos em seus clusters kubernetes
Kind é uma ferramenta que permite executar Clusters Kubernetes usando docker containers.
kind create cluster
- Visualizando os nós com kind
kind get clusters
- Listar nós
kubectl get nodes
- Executar o comando a seguir para selecionar e remover todos os clusters locais criados no Kind.
kind delete clusters $(kind get clusters)
- Executar arquivo de especificação kind-3nodes.yaml
kind create cluster --name kind-multinodes --config kind-3nodes.yaml
- Validar a criação do cluster com o comando a seguir
kubectl get nodes
Adicionar seguinte label ao namespace para que o ISTIO injete os Sidecars proxy automaticamente quando realizarmos o deploy da aplicação
kubectl label namespace default istio-injection=enabled
Para ambientes sem load balancer externo
export INGRESS_PORT=$(kubectl -n istio-system get service istio-ingressgateway -o jsonpath='{.spec.ports[?(@.name=="http2")].nodePort}')
export SECURE_INGRESS_PORT=$(kubectl -n istio-system get service istio-ingressgateway -o jsonpath='{.spec.ports[?(@.name=="https")].nodePort}')
export INGRESS_HOST=$(kubectl get po -l istio=ingressgateway -n istio-system -o jsonpath='{.items[0].status.hostIP}')
export GATEWAY_URL=$INGRESS_HOST:$INGRESS_PORT
Verficar se IP e porta foram criadas
echo "$GATEWAY_URL
192.168.99.100:32194
├── app-gateway.yaml
├── destination-rule-all.yaml
├── kind-3nodes.yaml
├── portal-noticias
│ ├── db-deployment.yml
│ ├── db-noticias-configmap.yml
│ ├── db-noticias-svc.yml
│ ├── db-noticias.yml
│ ├── portal-configmap.yml
│ ├── portal-deployment-v1.yml
│ ├── portal-deployment-v2.yml
│ ├── portal-service.yml
│ ├── sistema-noticias-configmap.yml
│ ├── sistema-noticias-deployment-v1.yml
│ ├── sistema-noticias-deployment-v2.yml
│ ├── sistema-noticias-service.yml
│ └── sistema-noticias.yml
├── tasks
│ ├── virtual-service-portal-v1-30-70.yaml
│ └── virtual-service-portal-v1.yaml
└── virtual-service-all.yaml
Criar os seguintes items nessa ordem:
- Gateway
kubectl apply -f app-gateway.yaml
- Virtual Service
kubectl apply -f virtual-service-all.yaml
- Workloads
kubectl apply -f portal-noticias
- Destination Rules
kubectl apply -f destination-rule-all.yaml
Portal Noticias:
http://$GATEWAY_URL/
Sistema Noticias:
http://$GATEWAY_URL/sistema
ISTIO possui integração com Kiali dashboard e outras ferramentas de telemetria. Para adicionar basta navegar para a pasta do istio e executar o seguinte comando.
kubectl apply -f samples/addons
kubectl rollout status deployment/kiali -n istio-system
istioctl dashboard kiali
- Somente Portal V1
kubectl apply -f tasks/virtual-service-portal-v1.yaml
- Portal V1 30%
kubectl apply -f tasks/virtual-service-portal-v1-30-70.yaml
👤 Marcus Vinicius
- Github: marcusjava