Expose a service through vLB Layer4
Last updated
Last updated
Address
VNG CorporationTo be able to initialize a Cluster and Deploy a Workload , you need:
There is at least 1 VPC and 1 Subnet in ACTIVE state . If you do not have a VPC or Subnet yet, please create a VPC or Subnet according to the instructions here .
There is at least 1 SSH key in ACTIVE state . If you do not have any SSH key, please create an SSH key according to the instructions here .
Installed and configured kubectl on your device. Please refer here if you are not sure how to install and use kuberctl. In addition, you should not use a kubectl version that is too old, we recommend that you use a kubectl version that is no more than one version different from the cluster version.
A cluster in Kubernetes is a collection of one or more virtual machines (VMs) connected together to run containerized applications. Cluster provides a unified environment to deploy, manage, and operate containers at scale.
To initialize a Cluster, follow the steps below:
Step 1: Visit https://vks.console.vngcloud.vn/overview
Step 2: At the Overview screen , select Activate.
Step 3: Wait until we successfully create your VKS account. After Activate successfully, select Create a Cluster
Step 4: At the Cluster initialization screen, we have set up information for the Cluster and a Default Node Group for you. You can keep these default values or adjust the desired parameters for the Cluster and Node Group at Cluster Configuration, Default Node Group Configuration, Plugin. When you choose to enable option, by default we will pre-install this plugin into your Cluster.
Step 5: Select Create Kubernetes cluster. Please wait a few minutes for us to initialize your Cluster, the Cluster's status is now Creating .
Step 6: When the Cluster status is Active , you can view Cluster information and Node Group information by selecting Cluster Name in the Name column .
After the Cluster is successfully initialized, you can connect and check the newly created Cluster information by following these steps:
Step 1: Visit https://vks.console.vngcloud.vn/k8s-cluster
Step 3 : Rename this file to config and save it to the ~/.kube/config directory
Step 4: Perform Cluster check via command:
Run the following command to test node
If the results are returned as below, it means your Cluster was successfully initialized with 3 nodes as below.
Note:
When you initialize the Cluster according to the instructions above, if you have not enabled the Enable vLB Native Integration Driver option , by default we will not pre-install this plugin into your Cluster. You need to manually create Service Account and install VNGCloud Controller Manager according to the instructions below. If you have enabled the Enable vLB Native Integration Driver option , then we have pre-installed this plugin into your Cluster, skip the Service Account Initialization step, install VNGCloud Controller Manager and continue following the instructions from Deploy once. Workload.
The following is a guide for you to deploy the nginx service on Kubernetes.
Create nginx-service-lb4.yaml file with the following content:
Deploy this Service using:
Run the following command to test Deployment
If the results are returned as below, it means you have deployed Deployment successfully.
At this point, the vLB system will automatically create a corresponding LB for the deployed nginx app, for example:
You can get Load Balancer Public Endpoint information at the vLB interface. Specifically, access at https://hcm-3.console.vngcloud.vn/vserver/load-balancer/vlb/
For example, below I have successfully accessed the nginx app with the address: http://180.93.181.20/
You can see more about ALB at Working with Network load balancing (NLB) .
Attention:
Changing the name or size (Rename, Resize) of the Load Balancer resource on vServer Portal can cause incompatibility with resources on the Kubernetes Cluster. This can lead to resources becoming inactive on the Cluster, or resources being resynchronized, or resource information between vServer Portal and the Cluster not matching. To prevent this problem, use kubectl
Cluster resource management.
Step 2: The Cluster list is displayed, select the iconand select Download Config File to download the kubeconfig file. This file will give you full access to your Cluster.