-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcomandos.txt
77 lines (56 loc) · 3.04 KB
/
comandos.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
# Esboço do shell script
# Atenção:
# O arquivo possui algumas anotações e alguns comandos só deveriam ser executados uma vez!
# Não excute-o diretamente sem revisá-lo!
# Pré-requisitos:
# Utilizar um usuário sudoer
# Instalação do Docker: https://docs.docker.com/engine/install/centos/
# Manage Docker as a non-root user: https://docs.docker.com/engine/install/linux-postinstall/
# Instalando minikube v1.20.0 on Centos 7.9.2009 , Kubernetes v1.20.2
curl -LO https://storage.googleapis.com/minikube/releases/latest/minikube-linux-amd64
sudo install minikube-linux-amd64 /usr/local/bin/minikube
# Iniciando e habilitando ingress
minikube start --memory=10g
minikube addons enable ingress
# Instalando Helm v3 - https://helm.sh/docs/intro/install/
curl -fsSL -o get_helm.sh https://raw.githubusercontent.com/helm/helm/master/scripts/get-helm-3
chmod 700 get_helm.sh
./get_helm.sh
rm -f ./get_helm.sh
# "Instalando" o kubectl (a preguiça falou mais alto :P)
alias kubectl="minikube kubectl --"
# Criando o namespace
kubectl apply -f kube-yaml/ns.yaml
# Criando configmap
kubectl apply -f kube-yaml/simpleapp-cm.yaml
# Criando deployment
kubectl apply -f kube-yaml/simpleapp.yaml
# Criando service
kubectl apply -f kube-yaml/simpleapp-svc.yaml
# Criando ingress
sleep 40
kubectl apply -f kube-yaml/challenge-ingress.yaml
# Adicionando hosts em /etc/hosts
echo -e "$(minikube ip)\tapp.prova" | sudo tee -a /etc/hosts
echo -e "$(minikube ip)\tkibana.prova" | sudo tee -a /etc/hosts
# Adicionando helm repo elastic
helm repo add elastic https://helm.elastic.co
# Instalando Elasticsearch 7.13.1 - https://artifacthub.io/packages/helm/elastic/elasticsearch
helm install elasticsearch --version 7.13.1 elastic/elasticsearch --namespace prova -f helm-values/elasticsearch.yaml
# Instalando Kibana 7.13.1 - https://artifacthub.io/packages/helm/elastic/kibana
helm install kibana --version 7.13.1 elastic/kibana --namespace prova -f helm-values/kibana.yaml
# Instalando Fluentd 3.2.0 - https://artifacthub.io/packages/helm/kokuwa/fluentd-elasticsearch
helm repo add kokuwa https://kokuwaio.github.io/helm-charts
helm install fluentd --version 11.12.0 kokuwa/fluentd-elasticsearch --namespace prova -f helm-values/fluentd.yaml
# Instalando Prometheus 2.26.0 - https://artifacthub.io/packages/helm/prometheus-community/prometheus
helm repo add prometheus-community https://prometheus-community.github.io/helm-charts
helm install prometheus prometheus-community/prometheus --version 14.1.1 --namespace prova -f helm-values/prometheus.yaml
# Visualizando recursos
sleep 90
#kubectl get pod,service,deployment,ingress,daemonset -A | grep -vP '^(default|kube)'
watch -n 1 minikube kubectl -- get pod,service,deployment,ingress,daemonset -n prova
###############################################
# ANOTAÇÕES
###############################################
# Sobre Elasticsearch, Fluentd, Kibana: https://coralogix.com/blog/kubernetes-logging-with-elasticsearch-fluentd-and-kibana/
# No Kibana, usar filtro "kubernetes.container_name: simpleapp" ou "kubernetes.container_name.keyword: simpleapp"