Prompt

How do I build a secrets workflow for Kubernetes and GitHub Actions?

Technology / Cybersecurity1 observationLast seen Oct 25, 2026

Latest observation

Oct 25, 2026OpenAI APIWeb search: off

A solid secrets workflow for Kubernetes + GitHub Actions usually has one core rule:

Don’t store long-lived application secrets in GitHub or plain Kubernetes manifests.
Instead, keep secrets in a real secrets backend, and let workloads fetch them at runtime or inject them safely during deploy.

Recommended architecture

1) Use a central secrets manager

Pick one:

  • Cloud-native: AWS Secrets Manager / Parameter Store, GCP Secret Manager, Azure Key Vault
  • Platform-agnostic: HashiCorp Vault
  • Kubernetes-native syncing: External Secrets Operator, Secrets Store CSI Driver

This becomes the source of truth for sensitive values like:

  • DB passwords
  • API keys
  • TLS material
  • private service tokens

2) Use GitHub Actions only for non-secret CI/CD coordination

GitHub Actions should ideally store only:

  • short-lived cloud credentials via OIDC
  • deployment metadata
  • non-sensitive environment config

Avoid:

  • committing .env files
  • hardcoding Kubernetes Secrets in YAML
  • using long-lived cloud access keys in GitHub Secrets if you can use OIDC instead

3) Use OIDC from GitHub Actions to cloud provider

Instead of storing cloud access keys in GitHub Secrets, configure:

  • GitHub Actions OIDC identity provider
  • IAM role / workload identity / federated identity in your cloud

Then the workflow gets short-lived credentials only when needed.

Example uses:

  • authenticate to AWS, then fetch from Secrets Manager
  • authenticate to GCP, then read Secret Manager
  • authenticate to Azure, then read Key Vault

4) Inject secrets into Kubernetes at runtime

Best options:

Option A: External Secrets Operator

Kubernetes ExternalSecret objects reference secrets in your external store. The operator syncs them into K8s Secrets.

Pros:

  • simple
  • native K8s integration
  • good for app teams

Cons:

  • secret still ends up as a Kubernetes Secret object in etcd
  • you must secure etcd and RBAC carefully

Option B: Secrets Store CSI Driver

Pods mount secrets directly from the provider into the filesystem.

Pros:

  • can avoid storing secret material in Kubernetes Secrets
  • good for rotation and ephemeral access

Cons:

  • app needs to read from mounted files
  • more moving parts

Option C: App fetches secrets at runtime

The application authenticates to the secrets backend itself.

Pros:

  • strongest model
  • no secret material in Kubernetes manifests or GitHub

Cons:

  • app complexity increases
  • requires auth design per service

A practical workflow

Build-time / deploy-time

  1. Developer merges code to main
  2. GitHub Actions runs tests and builds image
  3. GitHub Actions uses OIDC to authenticate to cloud
  4. Workflow deploys manifests or Helm charts
  5. Kubernetes workload gets secrets from external store via CSI or External Secrets

Runtime

  1. Pod starts
  2. Pod receives secret as mounted file or synced K8s Secret
  3. App reads secret from environment or file
  4. Secret rotates in backend
  5. Operator/CSI driver refreshes pod secret automatically or on restart

Example: GitHub Actions with OIDC + Kubernetes deploy

GitHub Actions permissions

permissions:
  id-token: write
  contents: read

Authenticate to cloud

Provider-specific step examples:

  • AWS: aws-actions/configure-aws-credentials
  • Azure: azure/login
  • GCP: google-github-actions/auth

Then deploy

- name: Deploy
  run: |
    helm upgrade --install myapp ./chart \
      --namespace myns \
      --set image.tag=${{ github.sha }}

The workflow should not embed secret values directly.


Example: External Secrets Operator

Secret in backend

Store prod/db-password in AWS Secrets Manager or Vault.

ExternalSecret YAML

apiVersion: external-secrets.io/v1beta1
kind: ExternalSecret
metadata:
  name: db-secret
spec:
  refreshInterval: 1h
  secretStoreRef:
    name: my-secret-store
    kind: ClusterSecretStore
  target:
    name: db-secret
    creationPolicy: Owner
  data:
    - secretKey: password
      remoteRef:
        key: prod/db-password

App uses it

env:
  - name: DB_PASSWORD
    valueFrom:
      secretKeyRef:
        name: db-secret
        key: password

Example: Secrets Store CSI Driver

Mount secret as a file:

volumes:
  - name: secrets-store
    csi:
      driver: secrets-store.csi.k8s.io
      readOnly: true
      volumeAttributes:
        secretProviderClass: my-secrets

App reads /mnt/secrets-store/db-password.


Best practices

Do

  • Use OIDC for GitHub Actions auth
  • Keep secrets in external secret store
  • Rotate secrets regularly
  • Use least-privilege IAM/RBAC
  • Separate dev/staging/prod
  • Audit access to secrets
  • Encrypt Kubernetes secrets at rest if you use them

Don’t

  • Put secrets in GitHub repo secrets unless necessary
  • Commit Kubernetes Secret manifests with plaintext values
  • Base64-encode and call it “encryption”
  • Share one cluster-wide secret store for everything without access controls

Suggested secure pattern

If you want a clean default architecture:

  • GitHub Actions: OIDC to cloud provider
  • Secrets backend: cloud secret manager or Vault
  • Kubernetes: External Secrets Operator or CSI driver
  • Apps: read secrets from env vars or mounted files
  • Rotation: backend-managed, synced to cluster automatically

If you want the simplest good setup

For most teams:

  • GitHub Actions + OIDC
  • AWS Secrets Manager / GCP Secret Manager / Azure Key Vault
  • External Secrets Operator
  • Helm or Kustomize for deployments

That gives a good balance of security and operational simplicity.

If you want, I can give you a reference implementation for:

  1. AWS + EKS + GitHub Actions,
  2. GCP + GKE + GitHub Actions, or
  3. Vault + Kubernetes + GitHub Actions.

Observation history

How did Obsurfable measure this prompt?

Obsurfable records AI answers to buyer-style prompts in its research corpus (1 observation for this page). Metrics are distributions over observations, not a single static ranking.

Which AI systems does Obsurfable collect answers from?

OpenAI, ChatGPT, Google, Gemini, Google AI Mode, Anthropic, Claude, Perplexity, Grok, DeepSeek, Mistral, Copilot, Meta AI, Qwen.

How can brands improve their AEO?

Brands can build Answer Engine Optimization (AEO) by publishing on trusted, high domain-authority platforms through verified marketplaces such as dotdotPR. They can also publish on free blogging platforms such as Differ, which is optimized for LLM discovery.

Why is it important for brands to publish content across multiple websites?

Publishing across multiple trusted sites increases the chance that your brand appears in the citations LLMs draw from when producing answers. Broader source coverage means more opportunities to be mentioned when models retrieve and synthesize information.

Want this interpreted for your brand?

Explorer is the free public corpus. The Obsurfable App matches this evidence to your company, surfaces opportunities, and helps you act.