AWS, Cloud Computing, DevOps

3 Mins Read

Enhancing Security in Amazon EKS with HashiCorp Vault

Voiced by Amazon Polly

Introduction

As organizations migrate their applications to Kubernetes, managing secrets securely becomes crucial. HashiCorp Vault is a popular open-source tool that provides secrets management, encryption, and access control. When deployed in Amazon Elastic Kubernetes Service (EKS), Vault ensures that sensitive data such as API keys, passwords, and certificates are securely stored and accessed only by authorized applications and users.

Pioneers in Cloud Consulting & Migration Services

  • Reduced infrastructural costs
  • Accelerated application deployment
Get Started

Objective

To demonstrate how to deploy HashiCorp Vault on Amazon EKS and manage secrets securely.

Understanding HashiCorp Vault

HashiCorp Vault is an open-source tool to manage secrets and protect sensitive data. It offers:

  • Secure storage with encryption
  • Dynamic secrets management
  • Access control using policies
  • Audit logging for compliance
  • Integration with multiple authentication methods

Vault operates in client-server mode and can be deployed in different architectures, such as standalone, HA (High Availability), or integrated with cloud services like AWS.

Why Use HashiCorp Vault in Amazon EKS?

Deploying Vault in Amazon EKS provides:

  • Centralized secrets management for Kubernetes applications
  • Secure dynamic secrets generation (e.g., AWS IAM credentials, database credentials)
  • Kubernetes-native authentication for seamless integration
  • Encryption-as-a-service for protecting application data
  • Automated secrets rotation and revocation

Deployment Architecture

Vault can be deployed in Amazon EKS using different methods:

  • Standalone Deployment: For testing and non-production use cases
  • HA Deployment with Integrated Storage: Uses Raft storage for high-availability
  • HA Deployment with External Storage: Uses Amazon S3, Amazon DynamoDB, or Consul for durability

A typical Vault setup in Amazon EKS includes:

  • A Vault StatefulSet for running Vault instances
  • Persistent Volume Claims (PVCs) for storing secrets securely
  • Service Accounts & RBAC policies for authentication
  • Vault Agent Injector for automatic secret injection into pods

Installing and Configuring Vault on Amazon EKS

Prerequisites

  • AWS Account: Access to create Amazon EKS clusters.
  • Tools:
    • kubectl configured for your Amazon EKS cluster.
    • AWS CLI installed and configured.
    • Helm installed.

Step 1: Set Up Amazon EKS Cluster

Create an Amazon EKS Cluster: We can create an Amazon EKS cluster using the AWS Management Console or AWS CLI. Here’s an example using AWS CLI:

Update kubeconfig: After the cluster is created, configure kubectl:

Step 2: Install Helm

Helm is used to deploy the vault into Kubernetes.

Step 3: Deploy the HashiCorp Vault

  1. Add the HashiCorp Helm Repository: This will allow us to use the official vault helm chart.
  1.   Install HashiCorp Vault: Deploy Vault in “dev” mode for testing:
  1. Check Deployment: Verify the pods are running:

Step 4: Initialize and Unseal Vault

After deploying Vault, initiate it and store the unseal keys and root token. Connect to the Vault pod

  1. Access the Vault Pod:

Capture the unseal keys and root token.

  1. Initialize Vault: Inside the pod:

Store the unseal keys and root token securely.

  1. Unseal Vault: Use the provided unseal keys:
  • vault operator unseal <unseal-key-1>
  • vault operator unseal <unseal-key-2>
  • vault operator unseal <unseal-key-3>

4. Login to Vault:

Step 5: Store and Retrieve Secrets:

  1. Store a Secret:
  1. Retrieve a Secret:

Step 6: Integration with Kubernetes  

Vault’s Kubernetes agent injector can inject secrets into my Kubernetes applications.

  1. Enable Kubernetes Auth Method:
  1. Configure the Kubernetes Auth Method: Write the configuration with your Kubernetes details:
  1. Create a Policy: Define a policy to allow access to the secrets:
  1. Create a Kubernetes Service Account:

.yaml

  1. Bind the Policy to the Service Account:

Step 7: Use Vault in Your Applications

Deploy an application to Access Secrets:

  • Create a Kubernetes service account and deploy a pod using that service account. The pod will authenticate with the vault and retrieve secrets.
  • Deploy the app using the Vault agent to retrieve secrets:

.yaml

Conclusion

HashiCorp Vault provides a solution for securing secrets in an Amazon EKS environment. Applications can securely retrieve secrets by integrating Vault with Kubernetes authentication without exposing credentials in environment variables or configuration files.

Automating secret management in Kubernetes enhances security, compliance, and operational efficiency. This guide helps set up a basic Vault deployment in Amazon EKS. Still, organizations should further explore Vault features like auto-unseal with AWS KMS, dynamic secrets, and advanced access controls for production use.

Drop a query if you have any questions regarding HashiCorp Vault and we will get back to you quickly.

Making IT Networks Enterprise-ready – Cloud Management Services

  • Accelerated cloud migration
  • End-to-end view of the cloud environment
Get Started

About CloudThat

CloudThat is a leading provider of Cloud Training and Consulting services with a global presence in India, the USA, Asia, Europe, and Africa. Specializing in AWS, Microsoft Azure, GCP, VMware, Databricks, and more, the company serves mid-market and enterprise clients, offering comprehensive expertise in Cloud Migration, Data Platforms, DevOps, IoT, AI/ML, and more.

CloudThat is the first Indian Company to win the prestigious Microsoft Partner 2024 Award and is recognized as a top-tier partner with AWS and Microsoft, including the prestigious ‘Think Big’ partner award from AWS and the Microsoft Superstars FY 2023 award in Asia & India. Having trained 650k+ professionals in 500+ cloud certifications and completed 300+ consulting projects globally, CloudThat is an official AWS Advanced Consulting Partner, Microsoft Gold Partner, AWS Training PartnerAWS Migration PartnerAWS Data and Analytics PartnerAWS DevOps Competency PartnerAWS GenAI Competency PartnerAmazon QuickSight Service Delivery PartnerAmazon EKS Service Delivery Partner AWS Microsoft Workload PartnersAmazon EC2 Service Delivery PartnerAmazon ECS Service Delivery PartnerAWS Glue Service Delivery PartnerAmazon Redshift Service Delivery PartnerAWS Control Tower Service Delivery PartnerAWS WAF Service Delivery PartnerAmazon CloudFrontAmazon OpenSearchAWS DMSAWS Systems ManagerAmazon RDS, and many more.

FAQs

1. Why should I use HashiCorp Vault in Amazon EKS instead of Kubernetes Secrets?

ANS: – Kubernetes Secrets are stored in etcd, which requires manual encryption setup and lacks strong access control, audit logging, and rotation capabilities. Vault provides:

  • Automatic encryption at rest.
  • Granular access control with Vault Policies.
  • Audit logs for every access.
  • Dynamic secrets and automated rotation.

2. What are the recommended deployment best practices for Vault in Amazon EKS?

ANS: – Deploy Vault using Helm.

  • Use Auto Unseal with AWS KMS.
  • Enable Audit Logs and forward them to Amazon CloudWatch or a log aggregator.
  • Use IRSA for pods accessing Vault.
  • Run Vault in HA mode across multiple availability zones.
  • Apply Vault Policies to control who can access which secrets.

WRITTEN BY Gopinatha N

Share

Comments

    Click to Comment

Get The Most Out Of Us

Our support doesn't end here. We have monthly newsletters, study guides, practice questions, and more to assist you in upgrading your cloud career. Subscribe to get them all!