Wrapping up: GenAI Coding Assistants and Further Reading
local graph
Chapter 14 — Wrapping up: GenAI Coding Assistants and Further Reading
Section titled “Chapter 14 — Wrapping up: GenAI Coding Assistants and Further Reading”In the last few years, GenAI has significantly evolved, and there are now numerous GenAI-based coding assistants that can help with creating, launching, and monitoring K8s clusters. Since the field is evolving at a rapid pace, in this chapter, we will cover some of the coding assistants, evolving trends, and good references to read for further information.
In this chapter, we’re going to cover the following main topics:
- GenAI-powered coding assistants
- GenAI-powered observability and optimization
- Amazon Q Developer walk-through with Amazon EKS
- References for further reading
GenAI-powered coding assistants
Section titled “GenAI-powered coding assistants”GenAI-powered assistants are transforming K8s cluster creation, deployment, and management by automating config file creation, workload scaling, and monitoring. Some GenAI-based coding assistants that can help with K8s clusters are the following:
Amazon Q Developer(https://aws.amazon.com/q/developer/): This is Amazon’s GenAI assistant, designed to help with cloud-based development, including K8s management on Amazon Elastic Kubernetes Service (EKS). It simplifies writing deployment manifests, automating infrastructure as code (IaC), and diagnosing issues in K8s deployment. It can also assist with optimizing cluster configurations by providing recommendations for resource allocation, autoscaling settings, and networking configurations. In this chapter, we will provide a walk-through on how to use AWS Q Developer for an EKS cluster deployment. We chose Amazon Q Developer for the walk-through since we are operating in an AWS environment.GitHub Copilot(https://github.com/features/copilot): This is an AI-powered coding assistant that can integrate into IDEs, such as Visual Studio Code and JetBrains. It can create K8s deployment code, such as deployment manifests, Helm charts, and CI/CD pipeline configurations. By providing inline suggestions and auto-completion, Copilot can accelerate K8s automation and ensure adherence to best practices.Google Gemini Code Assist(https://codeassist.google/products/business): This coding assistant can work across the software development life cycle. It can help with K8s workload optimization and infrastructure management and provide insights into scaling policies, cluster health, and performance tuning. By leveraging AI, Gemini suggests ways to optimize cost efficiency and minimize downtime, especially for GKE clusters.Microsoft Copilot in Azure(https://azure.microsoft.com/en-us/products/copilot): This can assist developers working with Azure Kubernetes Service (AKS). It provides recommendations for cluster scaling, node pool configurations, and security policies. Azure AI Copilot also integrates with Terraform and Bicep, allowing DevOps teams to automate K8s infrastructure provisioning efficiently.IBM watsonx Code Assistant(https://www.ibm.com/products/watsonx-code-assistant): This is particularly useful for teams using OpenShift and K8s in hybrid cloud environments. It automates application containerization, suggesting optimizations for container images, network policies, and security hardening. It also integrates with Red Hat OpenShift GitOps, allowing AI-driven automation of CI/CD pipelines and application deployment strategies.- K8sGPT (https://k8sgpt.ai/): This is an open source tool that brings AI-powered diagnostics to K8s clusters by leveraging GenAI to identify, analyze, and explain issues. It can be run locally using a CLI or deployed in a K8s cluster for continuous analysis. It supports a variety of AI backends, including OpenAI, or even local LLMs through tools such as Ollama or LangChain, giving teams flexibility based on their data privacy needs. It scans various K8s resources, such as Pods, Services, Deployments, and Nodes, and detects problems such as crash loops, configuration errors, or failed health checks. Instead of K8s error messages, K8sGPT can provide clear, human-readable explanations along with suggested remediation steps, making it especially helpful for developers and SREs troubleshooting complex environments.
For example, instead of a vague
CrashLoopBackOfferror, K8sGPT might explain that a Pod is crashing because it’s missing a required secret or has a misconfigured environment variable.
In this section, we explored several GenAI-powered coding assistants that aid in software deployment, generating IaC, and debugging K8s clusters. However, when working with AI-generated configurations, such as Amazon Q Developer or any other GenAI assistant, it’s essential to validate output manually and test it in a staging environment before deployment. Tools such as terraform plan, docker scan, and kubeval can help verify syntactic correctness and highlight configuration issues. Consider using policy-as-code frameworks, such as Open Policy Agent (OPA), to enforce security standards automatically.
In the next section, we will discuss how GenAI is transforming the K8s observability and optimization landscape.
GenAI-powered observability and optimization
Section titled “GenAI-powered observability and optimization”Besides generating the K8s manifest files, GenAI is also transforming K8s operations by automating security, monitoring, and optimization. These AI-powered solutions are making K8s environments more efficient, cost-effective, and self-healing. Some good examples are the following:
- AI-powered K8s autoscaling: Traditional K8s autoscalers rely on CPU and memory thresholds, but AI-powered autoscalers predict workload demands and dynamically adjust resources to optimize performance and costs. Tools such as StormForge (https://stormforge.io/) and PredictKube (https://dysnix.com/predictkube) leverage machine learning (ML) to enhance autoscaling strategies, preventing over-provisioning while ensuring availability during traffic spikes.
- AI-assisted K8s governance and policy enforcement: AI-driven governance tools enforce compliance and security policies in K8s clusters. By integrating ML models trained in historical data and policy violations, one can go beyond static rule definitions. For example, one can analyze historical policy violations and detect patterns, such as which resources are most affected and under what conditions. Based on learned patterns, AI can suggest new rules to tighten access beyond the static rules for policy enforcers, such as OPA.
- GenAI for K8s workflows and observability: AI-powered observability tools analyze logs, metrics, and traces to identify anomalies before they impact applications. Solutions such as New Relic AI (https://newrelic.com/platform/new-relic-ai) and Dynatrace Davis AI (https://www.dynatrace.com/platform/artificial-intelligence/) can automate root cause analysis and alert prioritization, helping DevOps reduce downtime and improve troubleshooting efficiency. Prometheus with AI models enhances smart alerting by filtering out non-critical events and focusing on actionable insights.
- Envoy AI Gateway (https://aigateway.envoyproxy.io/docs/): This was developed to simplify the increasingly complex task of connecting modern applications to GenAI services. Built on Envoy Proxy, the project offers a unified layer to manage LLM/AI traffic at scale. Key goals of the project include providing seamless routing and policy control for GenAI workloads, supporting automatic failover for resilient service delivery, securing AI traffic with upstream authorization, and enabling usage limits through a flexible policy framework. At its core, Envoy AI Gateway aims to make GenAI infrastructure easier to integrate and safer to operate. To use Envoy AI Gateway’s observability capabilities, users can configure Prometheus to scrape metrics exposed by the gateway, which include AI-specific insights such as token usage, time to first token, and per-token latency. These metrics follow OpenTelemetry’s GenAI semantic conventions and are designed to give visibility into how GenAI models are performing in production.
- Generative AI for K8s IaC: AI-powered assistants accelerate K8s infrastructure deployment by automatically generating YAML, Terraform, and Helm configurations. Tools such as Amazon Q Developer enable teams to describe their desired infrastructure in plain language and receive optimized configurations.
- AI-powered K8s cost optimization (FinOps): Optimizing cloud costs in K8s environments is challenging due to the dynamic nature of workloads. AI-powered FinOps solutions such as Harness (https://www.harness.io/solutions/finops-excellence) and Cast AI (https://cast.ai/) can analyze cluster utilization, suggest cost-saving measures, and adjust resource allocations to minimize waste. These tools help organizations optimize their K8s spending while maintaining application performance.
- GenAI-powered K8s ChatOps: AI-driven ChatOps tools enhance K8s management by enabling conversational interactions within platforms such as Slack and Microsoft Teams. Botkube AI Assistant (https://botkube.io/) allows users to query K8s clusters and execute commands via chat, while K8sGPT functions as an AI-powered K8s SRE, diagnosing and resolving cluster issues autonomously. AI-driven self-healing mechanisms can detect failures, restart Pods, and proactively fix issues without manual intervention.
In this section, we explored various AI-powered tools that can help transform K8s environments. These tools can be leveraged to automate key K8s operations such as autoscaling, security, cost optimization, and observability. In the next section, we’ll walk through how to use a GenAI assistant to simplify the development of K8s applications.
Amazon Q Developer walk-through with EKS
Section titled “Amazon Q Developer walk-through with EKS”In this section, we will explore how GenAI-powered assistants, such as Amazon Q Developer, can simplify the development of GenAI applications, streamline the creation and management of K8s clusters, and simplify deployments. Amazon Q Developer introduced a new agentic experience directly within the command-line interface (CLI), offering a dynamic and interactive coding experience. Agentic experiences refer to systems that actively assist users by understanding context, offering suggestions, and helping guide task completion. Amazon Q Developer iteratively refines changes based on your feedback and leverages information from your CLI environment to assist with local file operations, querying AWS resources, writing code, and automatically debugging issues.
Important note
When using GenAI-powered assistants for coding and executing local tasks such as running commands, always review generated code and commands thoroughly. Ensure they are secure, appropriate for your environment, and won’t unintentionally affect critical resources or data.
Let’s get started:
Install Amazon Q Developer for command line by following the instructions at https://docs.aws.amazon.com/amazonq/latest/qdeveloper-ug/command-line-installing.html.
Open a terminal or command-line application and initiate a conversation with Amazon Q Developer using the following command:
$ q chatYou will be directed to the AWS Builder ID login page (https://docs.aws.amazon.com/signin/latest/userguide/sign-in-aws_builder_id.html) to allow permission to Amazon Q Developer for command line.
Type the following query in the CLI. Amazon Q Developer will process your input, considering the provided context, call the Amazon Bedrock API, and respond with an output as shown in Figure 14*.1*:

Figure 14.1 – Kubectl command generation using Amazon Q Developer
Now, let’s ask the GenAI assistant to create the IaC templates for creating a new Amazon EKS cluster along with a VPC, private and public subnets, and so on. Use the following prompt in the CLI:
$ Generate Terraform code for an Amazon EKS cluster with:- Cluster name "eks-genai-demo" in us-west-2 region using EKS v1.32- Dedicated VPC (CIDR 10.0.0.0/16) with public/private subnets across 3 AZs- 1 NAT gateway for internet access from private subnets- Standard EKS Managed add-ons (Amazon VPC CNI, CoreDNS, kube-proxy)- Output cluster endpoint and access informationProvide modular, well-commented code with appropriate provider configurations and use open-source terraform modules where possible.Within a few seconds, Amazon Q Developer will generate Terraform code to create an Amazon VPC, EKS cluster, and so on, along with Terraform provider configuration, input variables, and outputs, as shown in Figure 14*.2*:

Figure 14.2 – Terraform code generation using Amazon Q Developer
We ran this prompt and uploaded the generated files to the GitHub repository at https://github.com/PacktPublishing/Kubernetes-for-Generative-AI-Solutions/tree/main/ch14/amazon-q-demo.
GenAI-powered coding assistants may use older versions of Terraform providers or modules, based on their training data. In the generated code, it used Terraform version >= 1.0.0, AWS provider >= 5.0.0, and so on. We can also give a follow-up prompt to use specific versions of these providers, as shown here:
$ Update the previous EKS cluster Terraform code to use the following provider versions:- Terraform version >= 1.9- AWS provider >= 5.63- Helm provider >= 2.15- Kubernetes provider >= 2.32Ensure all provider configurations are explicitly defined with these version constraints in the required_providers block, and the code remains compatible with these newer versions.Amazon Q Developer will reason the prompt, start reading the Terraform files from the local filesystem, and suggest the changes, as shown in Figure 14.3:

Figure 14.3 – Output of Amazon Q Developer
You can review the generated Terraform code and ask the agent to plan and deploy it to the AWS account using natural language prompts.
Similarly, you can use Amazon Q Developer to automatically generate complete project code from the ground up, such as for a to-do application that provides basic functionality to manage to-do tasks. Run the following prompt in an empty directory to generate a to-do application:
$ Please create a simple TODO application with the following specifications:Functionality- Create new tasks with title and description- Mark tasks as complete/incomplete- Delete tasks- View all tasksTechnical Requirements- Create a single application- Use in-memory storage for tasks (no need for a database)- Follow good coding practices with appropriate commentsDocker Requirements- Create a Dockerfile to containerize the application- The Dockerfile should follow best practices- Make it simple to build and run.Within no time, Amazon Q Developer will start creating a hierarchal project structure, source code files, Dockerfile for containerization, documentation, and so on. We executed this prompt and provided the generated files in the GitHub repository at https://github.com/PacktPublishing/Kubernetes-for-Generative-AI-Solutions/tree/main/ch14/todo-app. It created the project structure and files shown in Figure 14.4:

Figure 14.4 – Output of Amazon Q Developer
Review the generated files. To test the application locally, we can prompt Amazon Q Developer to build the container image and run it using Docker or Finch. Use the following prompt to build and run the container image:
$ Build and run the container image locally using Docker.On a different terminal, you use the following commands to verify the container image and running container:
$ docker images$ docker psFinally, we can take this a step further by asking the AI assistant to create the necessary K8s manifest files and deploy the application to a K8s cluster. Use the following prompt to create the K8s Deployment and Service resources:
$ Create necessary manifest files to deploy this application to a kubernetes cluster. Run two replicas of this app and expose it via ClusterIP service.Within a few seconds, Amazon Q Developer will generate K8s deployment, service, and namespace manifest files, among others, to deploy the to-do application to a K8s cluster, as shown in Figure 14.5:

Figure 14.5 – K8s manifest files created by Amazon Q Developer
In this section, we have explored how AI coding assistants such as Amazon Q Developer simplify software development tasks, including generating K8s configuration files and IaC templates for creating AWS and EKS resources. We have interacted with these assistants using natural language prompts, instructing them to perform various tasks such as building a container image, running applications locally, and modifying the generated code to meet specific requirements. In the next section, we will provide references for further reading on this topic.
References for further reading
Section titled “References for further reading”- https://kubernetes.io/docs/: Official Kubernetes documentation, always up to date and comprehensive
- https://github.com/kubernetes/kubernetes: The core Kubernetes GitHub repo with source code
- https://training.linuxfoundation.org/certification/: The Linux Foundation, in partnership with the Cloud Native Computing Foundation (CNCF), offers three key K8s certifications –
Certified Kubernetes Administrator(CKA),Certified Kubernetes Application Developer(CKAD), andCertified Kubernetes SecuritySpecialist(CKS) - https://kubernetes.io/blog/: The official blog with updates, best practices, and use cases
- https://kubernetes.io/community/: Community hub for contributing, SIGs, events, and getting involved
- https://www.cncf.io/projects/kubernetes/: K8s page on CNCF – project status, governance, and landscape
- https://github.com/aws-ia/terraform-aws-eks-blueprints: Official EKS blueprints using Terraform – modular and production-ready
- https://awslabs.github.io/data-on-eks/: Data on EKS is a tool to build, deploy, and scale Data & ML platforms on EKS
- https://aws.github.io/aws-eks-best-practices/: Official Amazon EKS Best Practices Guide, covering security, networking, scaling, GitOps, and more
- https://wellarchitectedlabs.com/architecture-guides/containers/eks-best-practices/: AWS Well-Architected Labs guide for EKS with practical labs and architecture reviews
Summary
Section titled “Summary”In this chapter, we covered how GenAI-based coding assistants are transforming the way K8s clusters are being built, deployed, and monitored. These tools automate IaC, optimize workloads, and enhance observability. Key assistants include Amazon Q Developer, GitHub Copilot, Google Gemini Code Assist, Microsoft Azure Copilot, IBM watsonx Code Assistant, and K8sGPT. They support everything from writing deployment manifests and Terraform configurations to real-time diagnostics and optimization of cluster performance.
GenAI tools also boost observability, security, and cost efficiency through AI-powered autoscaling, anomaly detection, and policy enforcement. Tools such as StormForge, PredictKube, and Dynatrace Davis AI automate root cause analysis and resource scaling, while others, such as Harness and Cast AI, assist with K8s FinOps.
Amazon Q Developer offers CLI-based support to generate and refine Terraform templates, build Docker containers, and deploy complete applications using simple natural language prompts. It supports creating modular IaC for EKS clusters and enables fast iteration through intelligent suggestions.
Lastly, we provided a curated list of references for deeper learning. These include official K8s documentation, GitHub repositories, and blogs offering best practices, patterns, and community resources. It also highlights certification programs from the Linux Foundation and CNCF. Together, these resources offer valuable guidance for mastering K8s and effectively using GenAI-powered tools in production environments. We hope you enjoyed reading this book and we will look forward to getting your feedback on how we can improve in future editions.
Get This Book's PDF Version and Exclusive Extras
Stay Sharp in Cloud and DevOps – Join 44,000+ Subscribers of CloudProSection titled “Stay Sharp in Cloud and DevOps – Join 44,000+ Subscribers of CloudPro”CloudPro is a weekly newsletter for cloud professionals who want to stay current on the fast-evolving world of cloud computing, DevOps, and infrastructure engineering. Every issue delivers focused, high-signal content on topics like:
Whether you’re a cloud engineer, SRE, DevOps practitioner, or platform lead, CloudPro helps you stay on top of what matters, without the noise. ![ |