Skip to content

DevFontes/eso

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

External Secrets Operator (ESO) Infrastructure

Infraestrutura base para o External Secrets Operator com integração ao OCI Vault usando Instance Principal (sem necessidade de credenciais estáticas).

Componentes

Core Infrastructure

  • External Secrets Operator (v1.3.1) - Sincronização de secrets de vaults externos
  • Reflector - Replicação automática de secrets entre namespaces
  • Instance Principal Authentication - Autenticação via Dynamic Group (mais seguro)

Integrações

  • OCI Vault - Vault externo para armazenamento seguro
  • OCI Dynamic Group - Para autenticação sem credenciais estáticas
  • OCI Policy - Permissões de acesso ao Vault

Arquitetura

┌─────────────────┐    ┌─────────────────┐    ┌─────────────────┐
│   OCI Vault     │ ←→ │  ESO Controller │ ←→ │  K8s Secrets    │
│                 │    │ (Instance       │    │                 │
│                 │    │  Principal)     │    │                 │
└─────────────────┘    └─────────────────┘    └─────────────────┘
                              │
                              ▼
                       ┌─────────────────┐
                       │   Reflector     │
                       │   (Replication) │
                       └─────────────────┘
                              │
                              ▼
                       ┌─────────────────┐
                       │  Other Namespaces│
                       └─────────────────┘

Pré-requisitos

OCI Infrastructure

  1. Criar Dynamic Group

    oci iam dynamic-group create \
      --compartment-id <TENANCY_OCID> \
      --name "k3s-cluster-nodes" \
      --description "K3s cluster nodes for OCI Vault access" \
      --matching-rule "any {instance.id = '<VM1>', instance.id = '<VM2>', ...}"
  2. Criar Policy

    oci iam policy create \
      --compartment-id <TENANCY_OCID> \
      --name "k3s-vault-access-policy" \
      --description "Allow K3s nodes to read secrets from Vault" \
      --statements "[
        \"Allow dynamic-group k3s-cluster-nodes to read secret-family in tenancy\",
        \"Allow dynamic-group k3s-cluster-nodes to read secret-bundles in tenancy\",
        \"Allow dynamic-group k3s-cluster-nodes to use vaults in tenancy\"
      ]"
  3. OCI Vault - Criar vault e adicionar secrets necessários

Cluster K3s

  • Kubernetes cluster rodando em instâncias OCI
  • Terraform >= 1.0
  • Kubectl configurado

Deploy

# Não precisa de variáveis de ambiente!
cd /home/julio/projects/julio/eso

terraform init
terraform plan
terraform apply

Validação

Após o deploy, verifique a instalação:

# Verificar pods do ESO
kubectl get pods -n external-secrets

# Verificar CRDs
kubectl get crd | grep external-secrets

# Verificar Reflector
kubectl get pods -n reflector-system

Uso em Outros Projetos

Outros projetos devem criar SecretStores usando Instance Principal:

Exemplo: SecretStore para namespace monitoring

apiVersion: external-secrets.io/v1beta1
kind: SecretStore
metadata:
  name: oci-vault
  namespace: monitoring
spec:
  provider:
    oracle:
      region: sa-saopaulo-1
      vault: <VAULT_OCID>
      principalType: InstancePrincipal
      # Sem auth section - usa Instance Principal automaticamente!

Exemplo: ExternalSecret para buscar secret do Vault

apiVersion: external-secrets.io/v1beta1
kind: ExternalSecret
metadata:
  name: grafana-admin
  namespace: monitoring
spec:
  refreshInterval: 1h
  secretStoreRef:
    name: oci-vault
    kind: SecretStore
  target:
    name: grafana-admin-secret
    creationPolicy: Owner
  data:
    - secretKey: password
      remoteRef:
        key: grafana-admin-password  # Nome do secret no OCI Vault

Vantagens do Instance Principal

Mais Seguro - Sem credenciais estáticas em secrets ✅ Rotação Automática - Managed pela OCI ✅ Menos Complexidade - Não precisa gerenciar fingerprint/privateKey ✅ Auditável - Logs centralizados na OCI

Features

  • ✅ ESO v1.3.1 deployment
  • ✅ Instance Principal authentication (no static credentials)
  • ✅ OCI Vault integration
  • ✅ Automatic secret replication via Reflector
  • ✅ Multi-namespace support
  • ✅ Secure and auditable access
  • ✅ Low resource footprint (~512MB total)

Consumo de Recursos

  • ESO: ~384MB (3 pods × 128Mi)
  • Reflector: ~128MB
  • Total: ~512MB

Ideal para clusters ARM com recursos limitados!

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages