- A Kubernetes(1.16+) Cluster(prefer to be provided by the Cloud platform or Minikube, 2 Core 4 Gi memory)
- Configure kubectl for you to be able to access above cluster as admin
- RBAC must be enabled in above cluster
- Install Helm3 (Recommend Helm 3.3+)
- Install Visual Studio Code(1.52+)
- Install Git
- Kubernetes api-server can be accessed internal and external
Step 1: Install nhctl and VSCode extension
Reference link: https://nocalhost.dev/installation/
Step 2: Initialize the cluster and setup Nocalhost Server
- Option 1: Kubernetes provided by the Cloud platform, such as Tencent TKE
For TKE clusters, configure open external network access: 0.0.0.0/0 or cluster egress IP to achieve access to the Kubernetes api-server internal and external.
Initialize at terminal:
nhctl init demo -n nocalhost -p 7000
- Option 2: If you use a Kubernetes cluster such as minikube, kind, k3s, microk8s, etc., use the following command to initialize:
nhctl init demo -n nocalhost -t nodeport
About Kubernetes without LoadBalancer and PV
Use NodePort instead of LoadBalancer, close DB persistence(DO NOT USE FOR PRODUCTION)
nhctl init demo -n nocalhost -t nodeport -p 7000 --force --set mariadb.primary.persistence.enabled=false
Waiting for the initialization process:
After the initialization:
[MINIKUBE WARN]: Please do not close above terminal for the port to be able to keep forwarding
nhctl init demo command flags
- --namespace: to specify which namespace to install.(create automately)
- --port: to specify which port Nocalhost Web to listen.(Default 80)
- --set: to overide values for Nocalhost's Helm Chart
- --type: to specify service type of Nocalhost Web(nodeport or loadbalaner)
- --force: to specify if delete old data before initialization
Step 3: Configure and login Nocalhost Server in VSCode
Open the VSCode extension page, click on the “Config Server URL” button at left:
Input the access address from Step Two, press Enter to save Input the username and password respectively, press Enter to save:
- Username: email@example.com
- Password: 123456
After login, you can find:
Step 4: Install demo application: bookinfo
Click the installation icon at the left to install application bookinfo
After it, Nocalhost starts to execute the installation.
You can click on the refresh icon to check the status of installation and startup process
After all microservices startup, You can click "GO" to open browser.
Now, you can visit the appliction website:
Step 5: Start DevMode
Switch the service to the DevMode by clicking on the green hammer icon.
Select “Clone from Git repo” and specify a local address for Nocalhost to clone the source code.
After the source code is checked out, Nocalhost will open a new VSCode window, and continue to switch to the DevMode.
When it is completed (it will take long time when it is the first time to run it), you will find:
Under the DevMode, the main process will not startup by default for the DevContainer, and therefore it will not respond the request from the website. While refresh the webpage, the webpage will be on error and will be recovered, until you start up again.
You can execute
sh run.sh to start your process.
Step 6: Change the code and check the result
You can try to change a piece of code, refresh and check the result. For example: add "Hello Nocalhost!" at line 355 in the file productpage.py. Do not forget to save the file. 😎
Refresh the webpage, here is the outcome: http://127.0.0.1:39080/productpage 😄
You have had a great experience about the Cloud Native development through above Nocalhost simple tutorial. You can start to try to configure and use the Nocalhost in the real project now.
Any feedback is welcomed. Github Issues: https://github.com/nocalhost/nocalhost