Creating an application

Creating an application from a template

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

  1. Choose the New Application command using the Cloud Code status bar.
  2. Select Kubernetes application for the type of sample.
  3. Select a template 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.
  5. On clicking enter, Cloud Code will clone your chosen template and open your newly created project for use.

    Creating a new app with the Cloud Code status bar

Template structure

All language template 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 respective 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 is used by Cloud Code to build, deploy and debug Kubernetes applications

Using your own application

If you'd like to use a project of your own, refer to this guide on setting up your application.

Getting Support

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