Skip to main content

Quick Start

About this guide

Goal: Install Nocalhost, evaluate the core features and experience efficient cloud-native application development.
Estimate time: 5 minutes
Requirements:

  • Any local or remote Kubernetes cluster (minikube, Docker Desktop, TKE, GKE, EKS, AKS, Rancher, ...). Allocate at least 4 GB of memory for single-node clusters like Docker Desktop and minikube.
  • RBAC must be enabled in the above cluster
  • Socat should installed in the nodes for cluster (Nocalhost file synchronization depends on port-forward)
  • Configured KubeConfig file that has namespace admin privilege
  • Kubernetes api-server can be accessed internal and external
  • Visual Studio Code (1.52+)

1. Install Nocalhost VS Code Extension#

  1. Open VS Code and go to Extensions by click the icon
  2. Input Nocalhost in the search box
  3. Select the Nocalhost Extension, and click the Install button.
VS Code Extension Market
JetBrains Plugin

Nocalhost does fully supports JetBrains, please refer to Install JetBrains Plugin.

2. Connect to Kubernetes Cluster#

Click on the Nocalhost icon on the side panel, open the Nocalhost plugin.

VS Code Connect to Cluster

There are two methods that you can use to connect to Kubernetes cluster:

Select the KubeConfig file from any local directory.

Default KubeConfig

Nocalhost will try to load KubeConfig from your local ~/.kube/config by default.

After KubeConfig is successfully loaded, select the context that you want to access, then connect to the cluster.

Nocalhost will automatically show the cluster list.

VS Code Cluster List

3. Enter Development Mode#

Application

We are using the bookinfo application as an example here. You can use your own application that already deployed in your Kubernetes clusters, or you can follow Deploy Demo Application to deploy the demo application in your Kubernetes clusters.

Make sure you have successfully deployed workloads within your Kubernetes Cluster, then:

  1. Expand the workloads tree, find the workload you want to develop
  2. Click to start the Development Mode (DevMode)
  3. Specify the source code local directory or you can clone from existing Git repository.
  4. Nocalhost will open a new VS Code window, and start the DevMode automatically.
Workload Enter DevMode
On premise case

If you are experiencing DevMode in on premise K8s cluster, you need to configure the sidecar image address additionally and push the image to your own repository.

4. Change Code and See Result#

Execute main process in remote Container#

1. Run the following command in the remote terminal to start main process

sh run.sh
Main Process

When entering DevMode, the application main process will not automatically start by default in the DevContainer, thus the application will not response any request. You need to manually start the main process before you can access it.

2. View the running result on http://127.0.0.1:39080 in your web browser

Execute the main process in remote terminal
Port-Forwarding

In our bookinfo demo, we've already set the port-forward to 39080:9080, which means Nocalhost will automatically forwards data from the local port 39080 to port 9080 on the defined DevContainer.

Change the code#

1. Modify code in productpage.py and see change in web browser. Do not forget to save your change.

2. Refresh the web browser and see the code change

Change code and see result

👍 Congratulations! You are all set to go

What's Next?#

Last updated on by Tank Xu