Offline Deployment
Single-Node Deployment¶
Note
Single-node deployment is only suitable for POC environments, not for production.
1. Prerequisites¶
1.1 Prerequisites for Using Sealos¶
- The hostname can be configured and must not contain underscores.
- Node time synchronization must be enabled.
- Run the
sealos runcommand on the first node of the Kubernetes cluster. Nodes outside the cluster are not supported for cluster installation. - It is recommended to use a clean OS for cluster creation. Do not install Docker manually.
- Most Linux distributions are supported, e.g., Ubuntu, CentOS, Rocky Linux.
- Only supported Kubernetes versions that have been released are supported.
- Containerd is supported as the container runtime.
- Use private IP addresses on public clouds.
2. Installation and Deployment¶
2.1 Configure the Installation Package¶
2.1.1 Download the Installation Package
2.2 Install Sealos¶
2.2.1 Install Sealos
Common sealos commands:sealos save Save a cluster image to a file
sealos load Load a cluster image from a file
sealos images List images
sealos rmi Delete a local image
sealos run imageId Run an application based on an image
sealos version View sealos version
sealos help Sealos help documentation
2.3 Install the Kubernetes Cluster¶
2.3.1 Install Kubernetes
sealos load -i calico_3.22.1.tar.gz && sealos load -i helm_3.8.2.tar.gz && sealos load -i kubernetes_1.24.0.tar.gz && sealos images
sealos run pubrepo.guance.com/googleimages/kubernetes:v1.24.0 pubrepo.guance.com/googleimages/helm:v3.8.2 pubrepo.guance.com/googleimages/calico:v3.22.1 --single
# Verify
kubectl get nodes
2.3.2 Change the Containerd Data Directory
The default data directory of containerd is under /. For Kubernetes 1.16 and later, when the disk usage of the default root directory reaches 85%, pods on the node will be evicted. To prevent pod eviction, we need to change the containerd data directory to a data disk.
# After all nodes are Ready, change the containerd data directory
vim /etc/containerd/config.toml
root = "/data/containerd"
mkdir -p /data/containerd
cp -r /var/lib/containerd/* /data/containerd
chmod 777 -R /data/containerd
# Restart containerd
sudo systemctl restart containerd
2.4 Install NFS¶
2.4.1 Disable the Firewall
2.4.2 Install the NFS Service
If the server has internet access, deploy NFS with the following commands:
If the server does not have internet access, find the nfs-package folder in the extracted files, locate the offline package for the corresponding OS version, and install it with the following commands:
2.4.3 Configure the NFS Shared Path
Create the shared directory:
Runvim /etc/exports to create the exports file with the following content:
Note:
/nfsdatais the shared directory configured for NFS. This directory should typically be on a separately mounted data disk, e.g.,/data/nfsdata.
2.4.4 Start the NFS Service
Run the following commands to start the NFS service:
2.4.5 Verify the Configuration
2.5 Install Kubernetes Storage¶
2.5.1 Install Kubernetes Storage
sealos load -i nfs_4.0.2.tar.gz
# Get the imageId of the NFS cluster image
sealos images
# Replace imagesId in the command below with the obtained cluster image ID
sealos run imagesId -e nfs_server=192.168.0.41,nfs_path=/nfsdata
Note: The imageId for other components below can be obtained and replaced in the same way.
Parameter Description:
| Name | Description | Value |
|---|---|---|
| nfs_server | Server IP | e.g., 192.168.3.143 |
| nfs_path | NFS shared path | e.g., /data/nfsdata |
2.6 Install Ingress¶
2.6.1 Install Ingress
Note: If the domain name is directly resolved to the server, you can add
hostNetwork: trueto the Ingress deployment configuration.
2.7 Install OpenEBS¶
2.7.1 Install OpenEBS
Note: Installing OpenEBS is optional. It uses local storage, which provides better performance than NFS.
2.8 Create the middleware Namespace¶
2.8.1 Create the middleware Namespace
2.9 Install MySQL¶
2.9.1 Install MySQL
Install MySQL using sealos:
sealos load -i mysql_8.0.tar.gz
# Example 1: Deploy with NFS disk type, StorageClass name df-nfs-storage
sealos run imageId -e storageclass_type=nfs,openebs_localpath='',nfs_name=df-nfs-storage
# Example 2: Deploy with OpenEBS disk type, local shared path /data/mysql_data
sealos run imageId -e storageclass_type=openebs,openebs_localpath='/data/mysql_data',nfs_name=''
Parameter Description:
| Name | Description | Value |
|---|---|---|
| storageclass_type | StorageClass type, can be nfs or openebs |
nfs or openebs (required) |
| openebs_localpath | Required only when storageclass_type is openebs. Specify the local path. |
e.g., /data/mysql_data (required when using OpenEBS) |
| nfs_name | If storageclass_type is nfs, specify the StorageClass name the PVC should bind to. |
e.g., df-nfs-storage (required when using NFS) |
2.9.2 Create a MySQL Config User
# Create guance_setup_user
kubectl -n middleware exec -it podname bash
# Enter the password rootPassw0rd
mysql -uroot -p
create user 'guance_setup_user'@'%' identified by 'Aa123456';
-- WITH GRANT OPTION allows this user to grant their own privileges to others
GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, ALTER, INDEX, LOCK TABLES, CREATE TEMPORARY TABLES, TRIGGER, EXECUTE, CREATE VIEW, SHOW VIEW, EVENT, GRANT OPTION, PROCESS, REFERENCES, RELOAD, CREATE USER, USAGE on *.* TO 'guance_setup_user'@'%' with GRANT OPTION;
FLUSH PRIVILEGES;
# Connection information
Connection address: mysql.middleware
Port: 3306
User: guance_setup_user
Password: Aa123456
2.10 Install OpenSearch¶
2.10.1 Install OpenSearch
Note: OpenSearch currently only supports NFS as the disk type.
Parameter Description:
| Name | Description | Value |
|---|---|---|
| nfs_name | If the StorageClass type is nfs, specify the StorageClass name the PVC should bind to. |
e.g., df-nfs-storage (required) |
2.10.2 Change the OpenSearch Default Password
# Change the password
kubectl exec -ti -n middleware opensearch-single-0 -- curl -u admin:admin \
-XPUT "http://localhost:9200/_plugins/_security/api/internalusers/elastic" \
-H 'Content-Type: application/json' \
-d '{
"password": "4dIv4VJQG5t5dcJOL8R5",
"opendistro_security_roles": ["all_access"]
}'
# Connection information
Connection address: opensearch-single.middleware
Port: 9200
User: elastic
Password: 4dIv4VJQG5t5dcJOL8R5
2.11 Install GuanceDB¶
2.11.1 Install GuanceDB
Note: GuanceDB currently only supports NFS as the disk type.
Parameter Description:
| Name | Description | Value |
|---|---|---|
| nfs_name | If the StorageClass type is nfs, specify the StorageClass name the PVC should bind to. |
e.g., df-nfs-storage (required) |
2.12 Deploy the Launcher¶
2.12.1 Download the Service Image Package
Image package download URL: https://static.guance.com/dataflux/package/guance-arm64-latest.tar.gz
Image package download URL: https://static.guance.com/dataflux/package/guance-amd64-latest.tar.gz
2.12.2 Download the Launcher Helm Chart
Chart package download URL: https://static.guance.com/dataflux/package/launcher-helm-latest.tgz
2.12.3 Import the Service Image
# Import into containerd environment
gunzip guance-amd64-latest.tar.gz
ctr -n=k8s.io images import guance-amd64-latest.tar
2.12.4 Install the Launcher
helm install launcher launcher-*.tgz -n launcher --create-namespace \
--set ingress.hostName=launcher.dataflux.cn \
--set storageClassName=df-nfs-storage
2.12.5 Configure Single Replica for Services (Optional)
If you only want to use a single replica (e.g., for a POC environment), configure it as follows:
kubectl edit cm launcher-settings -n launcher
# Add the following configuration
settings.yaml: 'debug: True'
# After adding, restart the launcher service
kubectl -n launcher rollout restart deploy launcher
2.12.6 Access the Launcher
# Change the network mode of the Ingress. Edit the Ingress deployment and add:
hostNetwork: true
# After the change, configure local hosts. 8.130.126.215 is the server IP; port 80 must be open to the outside.
8.130.126.215 launcher.dataflux.cn
2.13 Deploy Services via the Launcher¶
After the launcher is deployed, refer to Getting Started with Installation to deploy the service components.