aster.cloud aster.cloud
  • /
  • Platforms
    • Public Cloud
    • On-Premise
    • Hybrid Cloud
    • Data
  • Architecture
    • Design
    • Solutions
    • Enterprise
  • Engineering
    • Automation
    • Software Engineering
    • Project Management
    • DevOps
  • Programming
  • Tools
  • About
  • /
  • Platforms
    • Public Cloud
    • On-Premise
    • Hybrid Cloud
    • Data
  • Architecture
    • Design
    • Solutions
    • Enterprise
  • Engineering
    • Automation
    • Software Engineering
    • Project Management
    • DevOps
  • Programming
  • Tools
  • About
aster.cloud aster.cloud
  • /
  • Platforms
    • Public Cloud
    • On-Premise
    • Hybrid Cloud
    • Data
  • Architecture
    • Design
    • Solutions
    • Enterprise
  • Engineering
    • Automation
    • Software Engineering
    • Project Management
    • DevOps
  • Programming
  • Tools
  • About
  • Engineering

Develop And Debug Kubernetes Microservice Applications Fast With Cloud Code And Skaffold Modules

  • aster_cloud
  • January 27, 2022
  • 5 minute read

Microservice applications are popular, and for good reason. They offer flexibility over monolithic applications, and superior scalability when containerized and deployed to Kubernetes. To be functional, a microservice application must run all its services.

Issues arise when you want to build your application as a whole for your CI/CD pipeline and still be able to develop a subset of microservices. This is where Skaffold modules help.


Partner with aster.cloud
for your next big idea.
Let us know here.


cyberpogo

Skaffold modules give microservice developers the ability to build and deploy parts of their applications separately. This results in an efficient development flow that enables:

  • Iterating on and debugging a subset of microservices
  • Cross-boundary microservice debugging
  • Reduced build time and faster iterations when using remote dependencies and prebuilt artifacts

Skaffold is a command line tool that facilitates continuous development for Cloud Native applications. Skaffold handles the workflow for building, pushing, and deploying your application, and provides building blocks for creating CI/CD pipelines.

To support iterative microservice development for Skaffold users using IDEs, module support was recently added to Cloud Code. Cloud Code is Google Cloud’s IDE plugin for IntelliJ and Visual Studio Code. With Cloud Code, we’re bringing Skaffold to where you’re at; developing locally in your favorite IDE.

This post walks through how to develop and debug a sample microservice application with Skaffold modules from your IDE. We’ll also take a look at how to add Skaffold modules support to your own application.

Develop and debug microservices separately

Let’s see Skaffold modules in action with the IntelliJ version of Cloud Code. We’ll try Skaffold modules with Cloud Code’s Guestbook sample. The Guestbook sample is a simple microservice application that’s available in Node.js, Java, Python, and Go.

If you’re a Visual Studio Code user, install Cloud Code and check out our documentation for creating a sample Kubernetes app and configuring modules.

Read More  Google Cloud Biotech Acceleration Tooling

Before you begin

1. Install the Cloud Code plugin for JetBrains IDEs.

2. Create a new Cloud Code project by opening IntelliJ and navigating to File > New > Project… > Cloud Code: Kubernetes > Java: Guestbook.

 

3. Click Next and finish creating the project.

Run the application

The Java Guestbook sample has a frontend and backend microservice. As you would expect, the frontend microservice provides the UI, while the backend stores and serves records from a database. For more details about the guestbook sample application, open the sample’s README.md file.

First, edit the “Develop on Kubernetes” configuration. Under the Run tab, either select an existing Kubernetes cluster or “Deploy locally to a minikube cluster” to spin up a minikube cluster for free.

 

 

Now let’s deploy the full Guestbook application by running the “Develop on Kubernetes” configuration.

 

Cloud Code now builds the Guestbook sample application, packages it into containers, and deploys to the current Kubernetes cluster configured on your machine. The Run tool window looks similar to the following once the application is deployed. Clicking each step narrows the scope of the displayed logs, allowing you to focus on a specific container.

 

Open the Service URLs tab to access the port-forwarded application endpoints locally. You can test that the application is working by clicking the java-guestbook-frontend URL.

Once you’ve confirmed the application works, click the stop button. Cloud Code stops the application and cleans up the deployment in your cluster.

Run a single microservice

You’ve probably noticed that it takes a while to deploy this entire application. Now imagine having to deploy a much larger application with over a dozen microservices when you only want to develop one! This is where Cloud Code and Skaffold modules come into play.

Let’s edit the “Develop on Kubernetes” run configuration and select the Build/Deploy tab:

Read More  First Dedicated AI Management And MLOps Platform On Google Cloud Marketplace

 

Here you can see all the microservices of the application. For a microservice to appear in this list, it needs to be defined as a Skaffold module in your skaffold.yaml file. skaffold.yaml provides specifications for an application’s workflow. This sample has already done that.

Let’s build and deploy the “frontend” microservice.

 

Click OK and run “Develop on Kubernetes” again. This time Cloud Code only builds and deploys the frontend microservice.

 

Without the backend microservice, the frontend is just a UI view with no data. Deploying just the frontend allows testing that the frontend fails gracefully when the backend is unavailable.

More than likely your microservice development and debugging happens in a shared development cluster, where a backend team deploys their microservice that’s available for your frontend to interact with. This way, the backend and the frontend teams can develop a larger application independently while using the power of Cloud Code IDEs.

With Skaffold modules, backend and frontend code can live in either the same or separate repositories. Microservices can then be built together with a root skaffold.yaml file when all modules are selected. Each team can then work on their part by developing their module. See our documentation for more info on common Skaffold module use cases.

The larger your application and the more independent microservices it has, the more productive this workflow becomes.

Debug a microservice

Debugging your microservices is almost the same process as running them in your remote Kubernetes cluster. Run the “Develop on Kubernetes” configuration in debug mode.

 

Cloud Code ensures the container and application inside it run in debug mode and connects them to the IDE.

Now set breakpoints as if you are running locally and step through your application running in your remote cluster! You can find more details about debugging here.

Read More  Best Practices For Cloud Storage Cost Optimization

Configure Skaffold modules for your application

The Guestbook sample shows one way to use Skaffold modules with a very simple microservice application. If you’re working on a small microservice application, reference the Guestbook sample’s root skaffold.yaml. It provides a great starting point on how to structure your Skaffold configuration file.

 

apiVersion: skaffold/v2beta18
kind: Config
requires:
 - path: ./frontend
 - path: ./backend

 

This root configuration lists all the microservices of the application. Each microservice has its own Skaffold configuration that defines how to build and deploy it to Kubernetes. This sample has two Skaffold configurations for the frontend and backend.

You could provide alternative root configurations, such as a local development root that configures the backend with a local MySQL or PostgreSQL instance, or that activates specific Skaffold profiles.

To see Skaffold modules implemented in a larger example, see the Bank of Anthos application. It has 5+ larger microservices configured as Skaffold modules and is fully supported by Cloud Code IDEs. This is a great example of a large application that can be developed with Cloud Code and deployed with Cloud Deploy using the same Skaffold configuration.

Check out the Skaffold documentation to learn more about configuring Skaffold modules.

Next steps

We encourage you to try configuring your microservice project with Skaffold modules to experience the power and productivity of Skaffold and Cloud Code.

If you need help, join our GCP Community Slack Channel, #cloud-code, to connect with the community and ask questions.

To learn more about how Skaffold and Cloud Code work together, see Kubernetes development, simplified—Skaffold is now GA.

 

 

By: Ivan Portyankin (Software Engineer) and Abby Carey (Developer Advocate)
Source: Google Cloud Blog


Our humans need coffee too! Your support is highly appreciated, thank you!

aster_cloud

Related Topics
  • Cloud Code
  • Command Line
  • Containers
  • Google Cloud
  • Jetbrains
  • Kubernetes
  • Skaffold
You May Also Like
View Post
  • Architecture
  • Data
  • Engineering
  • People
  • Programming
  • Software Engineering
  • Technology

Predictions: Top 25 Careers Likely In High Demand In The Future

  • June 6, 2023
View Post
  • Design
  • Engineering

Building A Kubernetes Platform: How And Why To Apply Governance And Policy

  • June 4, 2023
View Post
  • Computing
  • Design
  • Engineering
  • Multi-Cloud

Amazing Federated Multicloud Apps

  • June 2, 2023
View Post
  • Engineering

Resolving Deployment Issues With Ts-node And Azure Development Pipelines

  • June 1, 2023
View Post
  • Design
  • Engineering

Four Steps To Managing Your Cloud Logging Costs On A Budget

  • May 31, 2023
View Post
  • Engineering
  • Tools

Red Hat Puts Podman Container Management On The Desktop

  • May 30, 2023
View Post
  • Engineering
  • Practices
  • Tools

Tricentis Launches Quality Engineering Community ShiftSync

  • May 23, 2023
View Post
  • Design
  • Engineering
  • Public Cloud

Kubernetes Costs Less, But Less Than What?

  • May 18, 2023

Stay Connected!
LATEST
  • 1
    Microsoft Offers Azure ML Data Import CLI, SDK For Snowflake, Other Databases
    • June 8, 2023
  • 2
    Why Are Humans Afraid Of AI?
    • June 7, 2023
  • 3
    The Technical Architecture And Components Of A.I. Systems
    • June 7, 2023
  • 4
    Nature Already Inspired A.I. Than Most Realise
    • June 7, 2023
  • 5
    “A Field Guide To AI: For Business, Institutions, Society & Political Economy” — Your Essential Companion In Navigating the World of Artificial Intelligence.
    • June 7, 2023
  • 6
    Predictions: Top 25 Careers Likely In High Demand In The Future
    • June 6, 2023
  • 7
    A S.W.O.T. Analysis Of Current A.I. Systems
    • June 6, 2023
  • Apple-WWCD23-Vision-Pro-glass-230605 8
    Introducing Apple Vision Pro: Apple’s first spatial compute
    • June 5, 2023
  • 9
    Apple Unveils New Mac Studio And Brings Apple Silicon To Mac Pro
    • June 5, 2023
  • 10
    Apple Introduces M2 Ultra
    • June 5, 2023
about
Hello World!

We are aster.cloud. We’re created by programmers for programmers.

Our site aims to provide guides, programming tips, reviews, and interesting materials for tech people and those who want to learn in general.

We would like to hear from you.

If you have any feedback, enquiries, or sponsorship request, kindly reach out to us at:

[email protected]
Most Popular
  • 1
    tvOS 17 Brings FaceTime And Video Conferencing To The Biggest Screen In The Home
    • June 5, 2023
  • 2
    Apple Introduces The 15‑Inch MacBook Air
    • June 5, 2023
  • 3
    Huawei ICT Competition 2022-2023 Global Final Held In Shenzhen — 146 Teams From 36 Countries And Regions Win Awards
    • May 27, 2023
  • 4
    Building A Kubernetes Platform: How And Why To Apply Governance And Policy
    • June 4, 2023
  • 5
    Leave, This “United” “Kingdom”, This “Great” “Britain”
    • June 4, 2023
  • /
  • Technology
  • Tools
  • About
  • Contact Us

Input your search keywords and press Enter.