Use Sealos to install a K8s cluster at light speed in an offline environment

Author: Yin Min. Sealos Open Source Community Ambassador, cloud native enthusiast.

When containerized delivery meets offline environments

In today's fast-paced software delivery environment, containerized delivery has become the technology of choice for many enterprises. In an environment with access to the public network, containerized delivery can not only improve the efficiency of software development and delivery, but also help enterprises achieve rapid iteration and continuous delivery.

However, in an offline environment, containerized delivery faces many challenges, including difficulty in preparing software packages and images, cumbersome configuration, and long deployment time. In this article, we will explore the pain points of using containerized delivery in offline environments from an operation and maintenance perspective, and propose some solutions to help enterprises achieve efficient containerized delivery in offline environments.

Business scene

Our company mainly targets government and enterprise customers , and the products delivered must be deployed on the intranet. As the person in charge of operations and maintenance, I have been worrying about how to deliver business systems in a containerized manner in the customer's offline environment. The unique environment of IDC computer rooms for government and enterprise customers has resulted in current operation and maintenance students being inefficient when using containerized delivery, and customer satisfaction is not high. In order to solve this problem, we need to find a solution that can quickly deploy and deploy in an offline environment. Tools for managing Kubernetes clusters.

There are the following common pain points with containerized delivery in offline environments:

1. High cost of learning and understanding

Kubernetes is a complex system that requires some learning and understanding before you can use it proficiently. This is a big difficulty for operation and maintenance engineers who are not very proficient in this technology.

2. Image management

In an offline environment, Kubernetes images and dependencies cannot be downloaded directly from the Internet. Therefore, you need to download the required images and dependencies locally in advance and import them into the Kubernetes cluster. This may take some time and effort.

3. Environment configuration

In an offline environment, you need to manually configure all the components and dependencies required by Kubernetes, such as etcd, kube-apiserver, kube-controller-manager, kube-scheduler, kubelet, kube-proxy, etc. This requires high operation and maintenance experience during deployment to troubleshoot and solve environment initialization problems.

4. Network settings

Kubernetes clusters need to have network settings configured correctly so that containers can communicate with each other. In an offline environment, network setup can be more complex and requires careful setup to ensure proper operation.

Based on the above common pain points, we can see that using containerization technology for delivery in an offline environment still has a high learning threshold and configuration difficulty, and cannot achieve the effect of lightning delivery out of the box.

solution

1. Use Sealos to achieve one-click packaging and lightning delivery?

Sealos can mirror the entire cluster like Docker to realize the construction, delivery and operation of distributed software.

Sealos project address: https://github.com/labring/sealos

2. Application scenarios

  • Kubernetes cluster installation
  • Kubernetes clusters, databases, middleware, and SaaS applications are all packaged and delivered with one click.
  • Offline delivery, multi-architecture support, localization support
  • Various distributed application delivery orchestrated on Kubernetes

3. Deployment architecture diagram

4. Write a Kubefile that is very similar to Dockerfile to build a cluster image and use Clusterfile to run a cluster.

Actual deployment

1. Download Sealos binaries

$ wget https://github.com/labring/sealos/releases/download/v4.1.4/sealos_4.1.4_linux_amd64.tar.gz \
   && tar zxvf sealos_4.1.4_linux_amd64.tar.gz sealos && chmod +x sealos && mv sealos /usr/bin

2. Write kubefile and build cluster image

Note: Here, the image containing Calico is encapsulated based on Kubernetes1.24.0 as a demonstration. The actual business image can also be encapsulated based on this method.

FROM labring/kubernetes:v1.24.0-amd64
COPY cni ./cni
CMD ["kubectl apply -f cni/tigera-operator.yaml","kubectl apply -f cni/custom-resources.yaml"]
$ sealos build -t registry.cn-hangzhou.aliyuncs.com/flowyun/kubernetes-calico:latest -f Kubefile .

3. Save the built image

$ sealos save -o Kubernetes.tar registry.cn-hangzhou.aliyuncs.com/demo/Kubernetes-calico:latest

4. Copy the sealos binary file and cluster image to the offline environment

$ tar zxvf sealos_4.1.4_linux_amd64.tar.gz sealos && chmod +x sealos && mv sealos /usr/bin
$ sealos load -i Kubernetes.tar

5. Check whether the cluster image is imported successfully

$ sealos images

6. Install the cluster

Note: Take stand-alone installation as an example, cluster installation is the same.

$ sealos run registry.cn-hangzhou.aliyuncs.com/demo/Kubernetes-calico:latest --single

7. Verify cluster

$ kubectl get pod -A

8. Access business system verification

Efficiency comparison

Deployment service name Traditional delivery methods are time-consuming to deploy Sealos lightning delivery method deployment time
MariaDB database 1’hour 1’min
Middleware (redis, nacos) 1’hour 30’min
Kubernetes setup 4’hour
Kubernetes component configuration and debugging 2’hour
Business system services 2’hour
12'hour/person 31'min/person

7. Summary

  1. Sealos can quickly deploy and upgrade Kubernetes clusters. Since Sealos uses offline packages to provide software, it does not need to rely on Internet connections and can quickly deploy and upgrade clusters in an offline environment, improving deployment efficiency.
  2. Sealos operates very stably and reliably in an offline environment. Since it is not affected by external network fluctuations, Sealos' design makes it very stable and reliable when running in an offline environment, improving reliability.
  3. Sealos uses offline packages and does not need to download software from the Internet, so it is less susceptible to network attacks and malware, improving security.
  4. Sealos uses standard Kubernetes YAML files to create clusters, which means users can customize and extend it to their needs, increasing flexibility.
  5. Sealos is simple to use and does not require complex configurations and commands. You only need to follow the guide to operate, which lowers the threshold for learning and use and improves ease of use.

Sealos is a powerful, easy-to-use tool that helps enterprises achieve efficient containerized delivery in offline environments. Sealos can quickly deploy and upgrade Kubernetes clusters. It runs very stably and reliably in an offline environment. It uses offline packages and does not need to download software from the Internet, so it is not susceptible to network attacks and malware. It uses standard Kubernetes YAML files to create clusters. , lowering the threshold for learning and using, and improving ease of use.

Guess you like

Origin blog.csdn.net/alex_yangchuansheng/article/details/132664063