Create an application in Cloud Code for VS Code

Stay organized with collections Save and categorize content based on your preferences.

Cloud Code lets you create a Kubernetes application based on a sample or from an existing project.

Creating an application from a sample application

Cloud Code comes with a collection of samples to get you started quickly. To create a Kubernetes application using an existing sample, follow these steps:

  1. Click Cloud Code status bar Cloud Code in the status bar and then select the New Application command.
  2. Select Kubernetes application for the type of sample.
  3. Select a sample based on the language you'd like to use from the available options: NodeJS, Go, Python, Java.
  4. Choose a preferred application location on your local machine and then press Enter.

    Cloud Code clones the sample you chose and opens your new project for use.

Sample application structure

All language sample applications have nearly the same structure. This is not the only supported structure but is recommended when starting.

For example, the Node.js Guestbook application structure looks like:

|---- .vscode
|      └---- launch.json
|---- kubernetes-manifests
|     |---- guestbook-backend.deployment.yaml
|     |---- guestbook-backend.service.yaml
|     |---- guestbook-frontend.deployment.yaml
|     |---- guestbook-frontend.service.yaml
|     |---- mongo.deployment.yaml
|     └---- mongo.service.yaml
|---- src
|     |---- backend
|     |     |---- Dockerfile
|     |     |---- index.js
|     |     |---- app.js
|     |     └---- package.json
|     |---- frontend
|           |---- Dockerfile
|           |---- index.js
|     |     |---- app.js
|           └---- package.json
└---- skaffold.yaml

Taking a closer look at this Kubernetes Guestbook Node.js sample app, here are some key files and their uses:

  • .vscode
    • extensions.json: prompt requesting download of related extensions when opening this project
    • launch.json: launch configuration (of type cloudcode.kubernetes) to run or debug the Kubernetes application
    • tasks.json: configuration information for Visual Studio Code Tasks
  • kubernetes-manifests
    • guestbook-backend.deployment.yaml: Pod specification for the backend nodes
    • guestbook-frontend.deployment.yaml: Pod specification for the frontend nodes
    • mongo.deployment.yaml: Pod specification for the database
  • src
    • (backend|frontend)/app.js: Node.js code with the web server logic
    • (backend|frontend)/Dockerfile: used to build the container image for our program
  • skaffold.yaml: config file for Skaffold, which Cloud Code uses to build, deploy and debug Kubernetes applications

Using your own application

For steps to use an existing project, see setting up your application.

Getting Support

To send feedback, report issues on GitHub, or ask a question on Stack Overflow.