Add OCI and K3s cluster connection documentation
This commit is contained in:
parent
fa2ff35cb2
commit
8379e6bbcf
2 changed files with 266 additions and 0 deletions
165
azure-devops/CLUSTER-CONNECTION.md
Normal file
165
azure-devops/CLUSTER-CONNECTION.md
Normal file
|
|
@ -0,0 +1,165 @@
|
||||||
|
# K3s Cluster - Conexão e Configuração
|
||||||
|
|
||||||
|
## Visão Geral
|
||||||
|
|
||||||
|
Documentação de conexão aos clusters Kubernetes baseados em **K3s** (Lightweight Kubernetes).
|
||||||
|
|
||||||
|
## Nós do Cluster
|
||||||
|
|
||||||
|
| Hostname | Função | IP | Utilizador | Chave SSH |
|
||||||
|
|----------|--------|----|------------|-----------|
|
||||||
|
| **Zeus** | Control Plane | `45.39.210.92` | root | `lh-zeus` |
|
||||||
|
| **Posseidon** | Control Plane | `45.39.210.21` | root | `lh-zeus` |
|
||||||
|
| **Apolo** | Worker Node | `45.143.7.55` | root | `lh-zeus` |
|
||||||
|
|
||||||
|
## Configuração SSH
|
||||||
|
|
||||||
|
### Arquivo de Configuração SSH
|
||||||
|
**Localização:** `C:\Users\TiagoRibeiro\.ssh\config`
|
||||||
|
|
||||||
|
```
|
||||||
|
Host zeus
|
||||||
|
HostName 45.39.210.92
|
||||||
|
User root
|
||||||
|
IdentityFile C:/Users/TiagoRibeiro/.ssh/lh-zeus
|
||||||
|
IdentitiesOnly yes
|
||||||
|
|
||||||
|
Host posseidon
|
||||||
|
HostName 45.39.210.21
|
||||||
|
User root
|
||||||
|
IdentityFile C:/Users/TiagoRibeiro/.ssh/lh-zeus
|
||||||
|
IdentitiesOnly yes
|
||||||
|
|
||||||
|
Host apolo
|
||||||
|
HostName 45.143.7.55
|
||||||
|
User root
|
||||||
|
IdentityFile C:/Users/TiagoRibeiro/.ssh/lh-zeus
|
||||||
|
IdentitiesOnly yes
|
||||||
|
```
|
||||||
|
|
||||||
|
### Chaves SSH
|
||||||
|
- **Chave Privada:** `C:\Users\TiagoRibeiro\.ssh\lh-zeus`
|
||||||
|
- **Chave Pública:** `C:\Users\TiagoRibeiro\.ssh\lh-zeus.pub`
|
||||||
|
|
||||||
|
## Conexão aos Nós
|
||||||
|
|
||||||
|
### Conectar via SSH
|
||||||
|
```bash
|
||||||
|
# Conectar a Zeus (Control Plane)
|
||||||
|
ssh zeus
|
||||||
|
|
||||||
|
# Conectar a Posseidon
|
||||||
|
ssh posseidon
|
||||||
|
|
||||||
|
# Conectar a Apolo
|
||||||
|
ssh apolo
|
||||||
|
|
||||||
|
# Ou diretamente pelo IP
|
||||||
|
ssh root@45.39.210.92
|
||||||
|
ssh root@45.39.210.21
|
||||||
|
ssh root@45.143.7.55
|
||||||
|
```
|
||||||
|
|
||||||
|
##ações K Oper3s
|
||||||
|
|
||||||
|
### Verificar Status do Cluster
|
||||||
|
```bash
|
||||||
|
# No nó Zeus
|
||||||
|
kubectl get nodes
|
||||||
|
kubectl get pods -A
|
||||||
|
kubectl get services -A
|
||||||
|
|
||||||
|
# Status do K3s
|
||||||
|
systemctl status k3s
|
||||||
|
```
|
||||||
|
|
||||||
|
### Contextos Kubernetes
|
||||||
|
```bash
|
||||||
|
# Listar contextos
|
||||||
|
kubectl config get-contexts
|
||||||
|
|
||||||
|
# Trocar de contexto
|
||||||
|
kubectl config use-context <context-name>
|
||||||
|
|
||||||
|
# Ver contexto atual
|
||||||
|
kubectl config current-context
|
||||||
|
```
|
||||||
|
|
||||||
|
### Exemplos de Comandos
|
||||||
|
```bash
|
||||||
|
# Ver pods em todos os namespaces
|
||||||
|
kubectl get pods -A
|
||||||
|
|
||||||
|
# Ver serviços
|
||||||
|
kubectl get svc -A
|
||||||
|
|
||||||
|
# Ver nós
|
||||||
|
kubectl get nodes -o wide
|
||||||
|
|
||||||
|
# Ver logs de um pod
|
||||||
|
kubectl logs -n <namespace> <pod-name>
|
||||||
|
|
||||||
|
# Ver eventos do cluster
|
||||||
|
kubectl get events -A --sort-by='.lastTimestamp'
|
||||||
|
```
|
||||||
|
|
||||||
|
## Stack Tecnológica
|
||||||
|
|
||||||
|
- **Distro**: K3s (Rancher)
|
||||||
|
- **Ingress Controller**: Traefik (Built-in)
|
||||||
|
- **Storage**: Local Path Provisioner
|
||||||
|
- **OS**: AlmaLinux 9.x
|
||||||
|
|
||||||
|
## Manutenção
|
||||||
|
|
||||||
|
### Reiniciar K3s
|
||||||
|
```bash
|
||||||
|
# Reiniciar serviço K3s
|
||||||
|
systemctl restart k3s
|
||||||
|
|
||||||
|
# Ver logs
|
||||||
|
journalctl -u k3s -f
|
||||||
|
```
|
||||||
|
|
||||||
|
### Backup K3s
|
||||||
|
```bash
|
||||||
|
# Backup dos recursos
|
||||||
|
kubectl get all -A -o yaml > k3s-backup.yaml
|
||||||
|
|
||||||
|
# Backup do etcd (se configurado)
|
||||||
|
k3s etcd-snapshot save
|
||||||
|
```
|
||||||
|
|
||||||
|
## Acesso Remoto (kubeconfig)
|
||||||
|
|
||||||
|
Para acesso remoto ao cluster, copie o kubeconfig de um dos nós:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# No nó Zeus
|
||||||
|
cat /etc/rancher/k3s/k3s.yaml
|
||||||
|
|
||||||
|
# Guardar localmente em ~/.kube/config
|
||||||
|
```
|
||||||
|
|
||||||
|
## Troubleshooting
|
||||||
|
|
||||||
|
### Verificar conectividade entre nós
|
||||||
|
```bash
|
||||||
|
# Ping entre nós
|
||||||
|
ping 45.39.210.92
|
||||||
|
ping 45.39.210.21
|
||||||
|
ping 45.143.7.55
|
||||||
|
|
||||||
|
# Ver portas abertas
|
||||||
|
ss -tuln | grep 6443 # API Server
|
||||||
|
```
|
||||||
|
|
||||||
|
### Verificar tokens de nó
|
||||||
|
```bash
|
||||||
|
# No nó master
|
||||||
|
cat /var/lib/rancher/k3s/server/node-token
|
||||||
|
```
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
*Documento gerado em: 2026-02-17*
|
||||||
101
azure-devops/OCI-CONNECTION.md
Normal file
101
azure-devops/OCI-CONNECTION.md
Normal file
|
|
@ -0,0 +1,101 @@
|
||||||
|
# Oracle Cloud Infrastructure (OCI) - Conexão e Configuração
|
||||||
|
|
||||||
|
## Visão Geral
|
||||||
|
|
||||||
|
Documentação de conexão à Oracle Cloud Infrastructure utilizada para criar e gerenciar clusters Kubernetes.
|
||||||
|
|
||||||
|
## Configuração SSH para OCI
|
||||||
|
|
||||||
|
### Configuração do SSH
|
||||||
|
**Arquivo:** `C:\Users\TiagoRibeiro\.ssh\config`
|
||||||
|
|
||||||
|
```
|
||||||
|
# OCI Compute Instances - adicionar conforme necessário
|
||||||
|
Host oci-*
|
||||||
|
HostName <IP_PUBLICO>
|
||||||
|
User opc
|
||||||
|
IdentityFile ~/.ssh/oci_key
|
||||||
|
IdentitiesOnly yes
|
||||||
|
```
|
||||||
|
|
||||||
|
## Repositório Terraform
|
||||||
|
|
||||||
|
### tf_oci_clusters
|
||||||
|
- **URL Azure DevOps:** https://dev.azure.com/CN-Squad/Invista%20FIDC%20-%20Nexus/_git/tf_oci_clusters
|
||||||
|
- **Conteúdo:** Definições Terraform para infraestrutura OCI
|
||||||
|
|
||||||
|
### Clonar Repositório
|
||||||
|
```bash
|
||||||
|
# Via HTTPS com PAT
|
||||||
|
git clone https://tiago.ribeiro:<PAT>@dev.azure.com/CN-Squad/Invista%20FIDC%20-%20Nexus/_git/tf_oci_clusters
|
||||||
|
|
||||||
|
# Via SSH (após configurar chave pública no Azure DevOps)
|
||||||
|
git clone git@ssh.dev.azure.com:v3/CN-Squad/Invista%20FIDC%20-%20Nexus/tf_oci_clusters
|
||||||
|
```
|
||||||
|
|
||||||
|
## Autenticação OCI
|
||||||
|
|
||||||
|
### Configuração OCI CLI
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Instalar OCI CLI
|
||||||
|
bash -c "$(curl -L https://raw.githubusercontent.com/oracle/oci-cli/master/scripts/install/install.sh)"
|
||||||
|
|
||||||
|
# Configurar autenticação
|
||||||
|
oci session authenticate
|
||||||
|
|
||||||
|
# Ou usar API Key
|
||||||
|
# 1. Criar chave privada
|
||||||
|
openssl genrsa -out ~/.oci/oci_api_key.pem 2048
|
||||||
|
|
||||||
|
# 2. Criar chave pública
|
||||||
|
openssl rsa -in ~/.oci/oci_api_key.pem -pubout -out ~/.oci/oci_api_key_public.pem
|
||||||
|
|
||||||
|
# 3. Upload da chave pública no OCI Console
|
||||||
|
# User Settings → API Keys → Add Public Key
|
||||||
|
```
|
||||||
|
|
||||||
|
### Variáveis de Ambiente
|
||||||
|
```bash
|
||||||
|
export OCI_TENANCY=<TENANCY_OCID>
|
||||||
|
export OCI_USER=<USER_OCID>
|
||||||
|
export OCI_FINGERPRINT=<FINGERPRINT>
|
||||||
|
export OCI_KEY_FILE=~/.oci/oci_api_key.pem
|
||||||
|
export OCI_REGION=us-ashburn-1
|
||||||
|
```
|
||||||
|
|
||||||
|
## Comandos Úteis OCI
|
||||||
|
|
||||||
|
### Listar Compute Instances
|
||||||
|
```bash
|
||||||
|
oci compute instance list --compartment-id <COMPARTMENT_OCID>
|
||||||
|
```
|
||||||
|
|
||||||
|
### Listar VCNs
|
||||||
|
```bash
|
||||||
|
oci network vcn list --compartment-id <COMPARTMENT_OCID>
|
||||||
|
```
|
||||||
|
|
||||||
|
### Listar Load Balancers
|
||||||
|
```bash
|
||||||
|
oci lb load-balancer list --compartment-id <COMPARTMENT_OCID>
|
||||||
|
```
|
||||||
|
|
||||||
|
## Recursos Gerenciados
|
||||||
|
|
||||||
|
| Recurso | Descrição |
|
||||||
|
|---------|-----------|
|
||||||
|
| Compute Instances | VMs para K3s clusters |
|
||||||
|
| VCN | Virtual Cloud Network |
|
||||||
|
| Load Balancers | Balanceamento de carga |
|
||||||
|
| Object Storage | Armazenamento |
|
||||||
|
| OKE | Oracle Kubernetes Engine |
|
||||||
|
|
||||||
|
## Links Úteis
|
||||||
|
|
||||||
|
- **OCI Console:** https://console.oraclecloud.com
|
||||||
|
- **OCI Documentation:** https://docs.oracle.com/en-us/oci/
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
*Documento gerado em: 2026-02-17*
|
||||||
Loading…
Reference in a new issue