DZone
Thanks for visiting DZone today,
Edit Profile
  • Manage Email Subscriptions
  • How to Post to DZone
  • Article Submission Guidelines
Sign Out View Profile
  • Post an Article
  • Manage My Drafts
Over 2 million developers have joined DZone.
Log In / Join
Please enter at least three characters to search
Refcards Trend Reports
Events Video Library
Refcards
Trend Reports

Events

View Events Video Library

Zones

Culture and Methodologies Agile Career Development Methodologies Team Management
Data Engineering AI/ML Big Data Data Databases IoT
Software Design and Architecture Cloud Architecture Containers Integration Microservices Performance Security
Coding Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks
Culture and Methodologies
Agile Career Development Methodologies Team Management
Data Engineering
AI/ML Big Data Data Databases IoT
Software Design and Architecture
Cloud Architecture Containers Integration Microservices Performance Security
Coding
Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance
Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks

The software you build is only as secure as the code that powers it. Learn how malicious code creeps into your software supply chain.

Apache Cassandra combines the benefits of major NoSQL databases to support data management needs not covered by traditional RDBMS vendors.

Generative AI has transformed nearly every industry. How can you leverage GenAI to improve your productivity and efficiency?

Modernize your data layer. Learn how to design cloud-native database architectures to meet the evolving demands of AI and GenAI workloads.

Related

  • How to Build the Right Infrastructure for AI in Your Private Cloud
  • How To Build Translate Solutions With Google Cloud Translate AI
  • Dynatrace Perform: Day Two
  • AI-Based Threat Detection in Cloud Security

Trending

  • Can You Run a MariaDB Cluster on a $150 Kubernetes Lab? I Gave It a Shot
  • How Kubernetes Cluster Sizing Affects Performance and Cost Efficiency in Cloud Deployments
  • Unit Testing Large Codebases: Principles, Practices, and C++ Examples
  • Designing a Java Connector for Software Integrations
  1. DZone
  2. Data Engineering
  3. AI/ML
  4. Provision Cloud Infrastructure Using Google Duet AI

Provision Cloud Infrastructure Using Google Duet AI

This article helps to create a GKS cluster with Google Duet AI, leveraging Duet AI prompts for guidance in EKS cluster creation.

By 
KONDALA RAO PATIBANDLA user avatar
KONDALA RAO PATIBANDLA
·
Jan. 22, 24 · Tutorial
Likes (3)
Comment
Save
Tweet
Share
3.9K Views

Join the DZone community and get the full member experience.

Join For Free

Duet AI by Google is an amazing tool for app developers. It uses advanced AI to make coding easier. You can talk to it like you talk to a friend, and it helps you write code, fix problems, and learn coding tricks. It's great for both experienced developers and beginners. Duet AI makes coding feel like a chat, making complex tasks simple and enjoyable.

This article guides you through leveraging Duet AI for the following tasks:

  • Explore various Google services that you can use to deploy an app to GKE by asking Duet AI context-based questions.
  • Prompt Duet AI to supply commands for deploying a basic app to a GKE cluster.
  • Utilize Duet AI to explain and generate shell commands for creating, exploring, and modifying the GKE cluster.

Deploy GKE Cluster

Imagine being an infrastructure admin tasked with establishing the infrastructure for a web application development team. The organization has adopted containers and Kubernetes as standards, prompting the team to seek guidance on running their web application efficiently on Kubernetes within Google Cloud. The team aims to minimize infrastructure management overhead.

1. Log in to the Google Cloud Console.

2. Click on the Duet AI icon in the top-right corner of the Google Cloud console toolbar.

Google Cloud console toolbar.

3. Click the Start Chatting button.

4. Enter the following prompt:

Plain Text
 
How can I run Kubernetes on Google Cloud without having to own management 
of nodes and the control plane?


Duet AI should respond with something similar to the following:

Plain Text
 
To run Kubernetes on Google Cloud without having to own management 
of nodes and the control plane, you can use Google Kubernetes Engine (GKE) 
in Autopilot mode. In Autopilot mode, Google manages the control 
plane and system components for you, and also manages your worker nodes.


Based on the information supplied by Duet AI, it appears that opting for a GKE autopilot cluster aligns with our requirements.

Deploy a GKE Autopilot Cluster

In this step, you instruct Duet AI on the process of deploying a GKE Autopilot cluster.

1. Enter the following prompt:

Plain Text
 
How do I create a GKE Autopilot cluster?


Duet AI provides guidance on creating a cluster through both the Google Cloud console and the Google Cloud CLI.

Plain Text
 
What is the command to create a GKE Autopilot cluster in my current project 
and in the lab region region named duet-ai-demo using the gcloud CLI?


Duet AI should respond with something similar to the following:

Plain Text
 
gcloud container clusters create-auto duet-ai-demo --region region


3. Click on the Cloud Shell icon in the Duet AI toolbar.

The command is copied to Cloud Shell.

4. Click Enter to run the command.

When provisioning is complete, the Kubernetes Engine > Clusters page looks like this screenshot:

Kubernetes Engine > Clusters

Deploy a Sample Web Application

After successfully setting up a GKE cluster in Autopilot mode, you've chosen to conduct a test by running a sample web application, which is the one your team plans to deploy on this infrastructure. Internally, you have bookmarked the following container image from Google (us-docker.pkg.dev/google-samples/containers/gke/hello-app:1.0) for the purpose of testing a containerized web application:

1. In the Duet AI pane, enter the following prompt, and then click Send:

Plain Text
 
What is the kubectl command to create a deployment called hello-server 
for the image us-docker.pkg.dev/google-samples/containers/gke/hello-app:1.0?


Duet AI will respond with something similar to:

Plain Text
 
To create a deployment called hello-server for the image 
us-docker.pkg.dev/google-samples/containers/gke/hello-app:1.0, 
you can use the following kubectl command:
kubectl create deployment hello-server 
--image=us-docker.pkg.dev/google-samples/containers/gke/hello-app:1.0


Run the kubectl command in the Cloud Shell.


2. With the web server now created, you now decide you want to test out provisioning a load balancer in front of the webserver to expose it to the internet.

In the Duet AI pane, enter the following prompt, and then click Send:

Plain Text
 
What is the kubectl command to expose this deployment on port 80 
and target port 8080 with a load balancer?


Duet AI should respond with something similar to the following:

Plain Text
 
To expose a deployment called hello-server with a load balancer, 
you can use the following kubectl expose command: 
kubectl expose deployment hello-server --type LoadBalancer --port 80 --target-port 8080 
This will create a Compute Engine load balancer for your container.


The section highlighted in the screen below showcases Duet AI prompting questions and providing answers as specified above.


3. Now, you want to see if the web server is running and serving requests properly. To view your deployed application, you need to retrieve the external IP address from the Kubernetes service you created.

Enter the following prompt:

Plain Text
 
What is the kubectl command to see 
the external IP address associated with this load balancer?


Duet AI should respond with something similar to the following:

Plain Text
 
To see the external IP associated with a load balancer, you can use the following kubectl command: 

kubectl get service hello-server 

This will output the name of the service, the type of service, 
the cluster IP address, the external IP address, and the ports that 
the service is listening on.


The section highlighted in the screen below showcases Duet AI prompting questions and providing answers as specified above.


4. In Cloud Shell, run the command provided by Duet AI.


You should see the hello-app running in the tab.

Conclusion

Duet AI is like a super helper for developers. It makes coding faster and helps them get more done. The easy-to-use interface and quick answers make developers happy and let them work better. Using Duet AI makes going from ideas to making things real much easier. It's like having a friendly assistant that makes coding faster and more productive.

AI Infrastructure Web application Cloud Google (verb) Load balancing (computing)

Opinions expressed by DZone contributors are their own.

Related

  • How to Build the Right Infrastructure for AI in Your Private Cloud
  • How To Build Translate Solutions With Google Cloud Translate AI
  • Dynatrace Perform: Day Two
  • AI-Based Threat Detection in Cloud Security

Partner Resources

×

Comments
Oops! Something Went Wrong

The likes didn't load as expected. Please refresh the page and try again.

ABOUT US

  • About DZone
  • Support and feedback
  • Community research
  • Sitemap

ADVERTISE

  • Advertise with DZone

CONTRIBUTE ON DZONE

  • Article Submission Guidelines
  • Become a Contributor
  • Core Program
  • Visit the Writers' Zone

LEGAL

  • Terms of Service
  • Privacy Policy

CONTACT US

  • 3343 Perimeter Hill Drive
  • Suite 100
  • Nashville, TN 37211
  • support@dzone.com

Let's be friends:

Likes
There are no likes...yet! 👀
Be the first to like this post!
It looks like you're not logged in.
Sign in to see who liked this post!