AWS Logo
Menu
Q-Bits: Create and deploy StatefulSets in EKS faster using Q Developer

Q-Bits: Create and deploy StatefulSets in EKS faster using Q Developer

Amazon Q Developer streamlines creation of Kubernetes manifests e.g. StatefulSets, explains Kubernetes concepts and configurations.

Hemant Garg
Amazon Employee
Published Apr 13, 2025
Welcome to another installment of Q-Bits, our regular series showcasing cool ways Amazon employees are leveraging Amazon Q Developer. Today, we're diving into how Q Developer can assist with creating and editing Kubernetes Manifest files for creating StatefulSet.
 

Introduction

Distributed systems (e.g., Kafka, Elasticsearch) and databases (e.g., MongoDB, PostgreSQL, Mysql) require stable identities, persistent storage, and ordered scaling when deployed into Kubernetes. These features are not available in Kubernetes Deployments but are instead provided by Kubernetes StatefulSets.
Unlike Deployments, StatefulSets guarantee:
  • Stable Network Identity: StatefulSets follow a predictable naming convention (e.g., app-db-0, app-db-1) and retain DNS records even after rescheduling.
  • Persistent Storage: StatefulSets gets a unique PersistentVolumeClaim, ensuring data survives pod restarts.
  • Ordered Operations: StatefulSets are created, scaled, and updated sequentially (e.g., MySQL primary-replica is started first).
Common use cases for StatefulSets include:
  • Databases (MongoDB, Cassandra, Mysql)
  • Clustered apps (Zookeeper, Redis, Kafka)
  • Message queues (Kafka, RabbitMQ)
  • Identity Software/SaaS (Ping Directory)
Creating StatefulSet manifests manually is error prone and time consuming due to their complexity. StatefulSets have intricate configurations and dependencies on other Kubernetes objects such as persistent volume claims (PVC) and persistent volumes (PVs). Q Developer addresses these challenges by automating Kubernetes manifest generation, validation, and deployment.
As an architect, I use Q Developer to understand Kubernetes concepts and create complex configurations. Q Developer accelerates StatefulSet workflows, from YAML creation to production ready deployment..

Understanding StatefulSets with Q Developer

I ask Q Developer to explain the difference between StatefulSet and Deployments using the following prompt:
Q Developer provides a clear explanation:
I followup with another question using the prompt:
Once the concepts around StatefulSet are clear, i ask Q Developer /dev Agent to create a StatefulSet manifest using the following prompt:
Q Developer generates the Kubernetes manifest yaml files and allows me to review the files before creating the files in my project workspace. It creates the yaml manifests for StatefulSet, service, configmaps, secrets etc. However i did not see the manifests for storageclass. So i used the option to 'Provide feedback and regenerate' with the following prompt.
Q Developer now creates all the necessary manifest files. After reviewing the generated manifests i accept the code recommendations. Q Developer creates the files in my existing workspace.
I then ask Q Developer for commands to deploy the Mysql StatefulSet to EKS.
Q Developer creates a instructions document file containing all the commands required to deploy and validate the StatefulSet.
I then use Q Developer Cli to create an EKS cluster in my AWS account and setup kubectl. I issue the kubectl commands as per the instructions file created by Q Developer to deploy the Mysql database to EKS cluster as a StatefulSet. I finally check the status of the Mysql StatefulSet to ensure the pods are running.

Validating the StatefulSet

I then ask Q Developer to define the strategy for testing the deployed Mysql StatefulSet using the following prompt:
Q Developer provides a comprehensive strategy for testing my deployed Mysql StatefulSet in EKS.

Conclusion

Q Developer accelerates the creation of Kubernetes (K8s) manifests, including StatefulSets. It streamlines the generation, deployment, and validation of K8s manifests, allowing DevOps teams to focus on building applications that deliver customer value. By automating routine tasks, Q Developer reduces development time and improves efficiency of deploying applications in EKS.
 

Any opinions in this post are those of the individual author and may not reflect the opinions of AWS.

Comments