How to add secrets in Kubernetes deployments
In Kubernetes, a secret is an object that stores sensitive data such as passwords, keys, and database URLs. Using secrets avoids embedding credentials in images or configuration files and improves cluster cybersecurity, as well as facilitating rotation and access control.
Creating and applying a secret: you can create a secret from the command line with kubectl create secret generic NAME --from-literal=KEY=VALUE or define a YAML manifest and apply it with kubectl apply -f /Users/josesaidolanogarcia/REPOSITORIOS/01.-secrets/curs-000367-mysql-dbs-urls-secret.yaml. After applying the manifest, verify with kubectl get secrets and kubectl describe secret NAME.
Use in a Deployment: to consume a secret, you can mount it as environment variables or as a secret-type volume. In the deployment manifest, you reference the secret by its name in envFrom or env to load values as variables, or you define a volume and mount it inside the container so the application reads files with the credentials.
Best practices: encrypt secrets at rest, limit access via RBAC, avoid uploading secrets to code repositories, rotate credentials periodically, and audit access. Consider using managed secret solutions such as AWS Secrets Manager or Azure Key Vault for secure integrations with aws and azure cloud services.
Advanced options: when greater security or pipeline integration is needed, use tools such as Sealed Secrets, External Secrets Operator, or cloud secret managers. These solutions enable key encryption and automatic synchronization between the secret manager and Kubernetes.
About Q2BSTUDIO: we are a software development company specialized in custom applications and custom software. We offer consulting and implementation in artificial intelligence, AI agent development, integration of aws and azure cloud services, and cybersecurity solutions to protect infrastructures and sensitive data. We also provide business intelligence services and solutions with power bi to turn data into actionable information.
How we help you: at Q2BSTUDIO we design secure deployments in Kubernetes, implement best practices for secret management, connect applications to cloud secret managers, and develop AI solutions for companies that include AI agents and dashboards with power bi. If you need a custom solution, we can develop custom applications that meet security, scalability, and observability requirements.
Keywords: custom applications, custom software, artificial intelligence, cybersecurity, aws and azure cloud services, business intelligence services, AI for companies, AI agents, power bi.
Contact Q2BSTUDIO for a technical consultation and a personalized proposal that improves the security and efficiency of your Kubernetes deployments.


