Install on Kubernetes
This documentation shows how to install Alluxio on Kubernetes via Operator, a Kubernetes extension for managing applications.
Prerequisites
Kubernetes
A Kubernetes cluster with version at least 1.19, with feature gates enabled
Ensure the cluster’s Kubernetes Network Policy allows for connectivity between applications (Alluxio clients) and the Alluxio Pods on the defined ports
The Kubernetes cluster has helm 3 with version at least 3.6.0 installed
Image registry for storing and managing container image
Hardware
Each node should have at least 8 CPUs and 32GB of memory
Each node should have at least 100GB of storage space
Permissions. Reference: Using RBAC Authorization
Permission to create CRD (Custom Resource Definition)
Permission to create ServiceAccount, ClusterRole, and ClusterRoleBinding for the operator pod
Permission to create namespace that the operator will be in
Preparation
Download the files for Alluxio operator and Alluxio cluster
Please visit the Alluxio download page and select Alluxio Enterprise AI to download. After the download is complete, extract the files using the following command:
After extraction, you will obtain the following files:
alluxio-operator-2.1.0-helmchart.tgzis the helm chart for deploying Alluxio operatoralluxio-operator-2.1.0-docker.taris the docker image for all Alluxio operator componentsalluxio-enterprise-AI-3.4-9.1.0-docker.taris the docker image for Alluxio
Upload the images to an image registry
An image registry is a centralized location for storing and sharing your container images. It can be either public or private. Cloud provider may come with its container registry as a service. For example, Amazon Elastic Container Registry(ECR), Azure Container Registry (ACR), and Google Container Registry (GCR). Private registries may also be provided from your local system or within private networks of your organization.
This example shows how to upload the Alluxio operator images.
Extract the helm chart for operator
The extracted alluxio-operator directory contains the Helm chart files responsible for deploying the operator.
Deployment
Deploy Alluxio operator
Create the alluxio-operator/alluxio-operator.yaml file to specify the image and version used for deploying the operator. The following example shows how to specify the operator image and version:
Move to the alluxio-operator directory and execute the following command to deploy the operator:
Deploying alluxio operator requires pulling dependent images from the public image repository. If you fail to deploy
alluxio-operatorbecause the network environment cannot access the public image repository, please refer to Configuring alluxio-operator image.
Deploy Alluxio
Create the alluxio-operator/alluxio-cluster.yaml file to deploy the Alluxio cluster. The file below shows the minimal configuration.
Please see Resource Prerequisites and Compatibility for resource planning recommendations.
The operator has already set the recommended configuration by default, which can start an Alluxio cluster. If you need to modify the configuration, you can edit the .spec.properties field in the alluxio-cluster.yaml file. The section for common use cases describes some general scenarios to modify these properties.
The properties specified under the
.spec.propertiesfield will be appended to thealluxio-site.propertiesconfiguration file and the Alluxio processes will read that file. You can find your configurations in the Alluxio coordinator, worker pod by looking at/opt/alluxio/conf/alluxio-site.properties.
If your training data is stored in S3, OSS, or other storage, and the training task can access the data via
s3://oross://, you can accelerate training by mounting the under file system into Alluxio through creating UFS resources after starting the Alluxio cluster.If your training task accesses the training data through PVC or NAS, you need to mount the training data's PVC or NAS to the Alluxio pods when creating the Alluxio cluster. Please refer to Mount storage to Alluxio for details on mounting PVC or NAS/hostPath, and modify the
alluxio-operator/alluxio-cluster.yamlaccordingly.
Move to the alluxio-operator directory and execute the following command to deploy the Alluxio cluster:
In Alluxio 3.x, the coordinator is a stateless control component that serves jobs like distributed load and acts as API gateway for the operator.
If some components in the cluster do not reach the
Runningstate, you can usekubectl describe podto view detailed information and identify the issue. For specific issues encountered during deployment, refer to the FAQ section.
Alluxio cluster also includes etcd and monitoring components. If the image cannot be pulled from the public image registry, causing etcd and monitoring to fail to start, please refer to Configuring Alluxio Cluster Image.
Mount storage to Alluxio
Alluxio supports integration with various underlying storage systems, including S3, HDFS, OSS, COS, and TOS. Please refer to the Storage Integration Overview.
With the operator, you can mount underlying storage by creating UnderFileSystem resources. An UnderFileSystem corresponds to a mount point for Alluxio. Regarding the Alluxio and the underlying storage namespace, please refer to Alluxio Namespace and Under File System Namespaces.
Below, we provide several examples of commonly used underlying storage mounts.
Executing the mount
First, ensure that the Alluxio cluster is up and running with a Ready status. (Or if the status is WaitingForReady, can also mount UFS)
Execute the following command to create the UnderFileSystem resource and mount that to Alluxio namespace:
Monitoring
The Alluxio cluster enables monitoring by default. You can view various Alluxio metrics visually through Grafana. Please refer to the Monitoring and Metrics section on Kubernetes Operator.
Data Access Acceleration
In the steps above, you deployed the Alluxio cluster and mounted the under file system to Alluxio. Training tasks that read data through Alluxio can improve training speed and GPU utilization. Majorly, Alluxio provides three ways for applications to access data:
FUSE based POSIX API: Please refer to FUSE based POSIX API.
S3 API: Please refer to S3 API.
FSSpec Python API: Please refer to FSSpec Python API.
Common use cases
Change the resource limitations
For every component, like worker, coordinator, and FUSE, we can change the resource by the following configuration:
The container will never be able to access the resource over the limits, and the requests are used during scheduling. For more information, please refer to Resource Management for Pods and Containers
The limit of the memory should be a little bit over the sum of the heap size(
-Xmx) and the direct memory size(-XX:MaxDirectMemorySize=10g) to avoid out-of-memory problems.
Use PVC for page store
Page store here refer to the cache Alluxio uses.
The PVC will be created by the operator
The
storageClassdefaults tostandard, but can be specified to empty string for static binding
Mount customized config maps
A custom config map can be used to provide configuration files on pods. Although it can be used for other purposes such as environment variables, the following example will focus on files.
Create a new config map from a local file:
Declare the config map with its mount point.
The key is the name of the
ConfigMap, and the value if the mounted path in the containerThe
/opt/alluxio/confis already mounted by default. This means other files cannot be mounted directly within theconf/directory. The custom config maps need to mount to other paths.Using the cache filter json file as an example, mount it to
/opt/alluxio/conf/cachefilter/cache_filter.jsonand set this path as the value ofalluxio.user.client.cache.filter.config.filefor Alluxio to read it.
Add a file onto pods as a secret
This mechanism can be used to provide credentials files on pods.
Create a new secret from a local file:
Specify which secrets to load and the file path on the pods.
Use the root user
The FUSE pod will always use the root user. The other processes use the user with uid 1000 by default. In the container, the user is named alluxio. To change it to the root user, use this configuration:
Sometimes it’s enough to specify the
.spec.fsGroup = 0only when the files can be accessed by the root groupThe ownership of the mounted host path, such as the page store path and log path, will be transferred to root if changing to the root user.
Use external ETCD
If you have an external ETCD cluster, you can specify the endpoints for Alluxio to use.
When Client-to-server transport security with HTTPS, certificates are used for SSL/TLS connections to ETCD. For this, have a signed key pair (server.crt, pkcs8_key.pem) ready.
Here it needs a PKCS8 key, you can use the following command to convert the key:
Create secrets in Kubernetes with the created server.crt and pkcs8_key.pem. For example,
Configure the etcd properties in the alluxio-cluster.yaml file and specify the secrets for the coordinator, worker and fuse:
Dynamically Update Alluxio Configuration in a Running Cluster
Get configmap
Edit configmap to update Alluxio configuration
There should be 4 files inside: alluxio-env.sh, alluxio-site.properties, log4j2.xml, and metrics.properties. Edit as you need, then save the configmap.
Restart Alluxio components as needed Assuming the cluster name is
alluxiowhich is specified inalluxio-cluster.yaml
coordinator:
kubectl rollout restart statefulset alluxio-coordinatorworker:
kubectl rollout restart deployment alluxio-workerdaemonset fuse (
fuse.type = daemonSet):kubectl rollout restart daemonset alluxio-fusecsi fuse (
fuse.type = csi): the csi fuse pods doesn’t have arollout restartcommand, you can wait for the user’s pod exit and the current csi fuse pod exit, and the new csi fuse pod will use the latest configuration. or you can manually kill the csi fuse pod:kubectl delete pod alluxio-fuse-xxx, and the restarted csi fuse pod will use the latest configuration.
FAQ
etcd pod stuck in pending status
For example, if three etcd pods remain in the Pending state, you can use kubectl describe pod to view detailed information:
Based on the error message, the etcd pods are stuck in the Pending state because no storage class is set. You can resolve this issue by specifying the storage class for etcd in the alluxio-operator/alluxio-cluster.yaml file:
First, delete the Alluxio cluster and the etcd PVC, then recreate the Alluxio cluster:
Another issue is the etcd PVC specifies a storage class, but both the etcd pod and PVC remain in a pending state. For example, as shown in the detailed information of the PVC below, the storage class specified for the etcd PVC does not support dynamic provisioning, and the storage volume needs to be manually created by the cluster administrator.
For similar issues where etcd pods remain in the Pending state, you can use the above method for troubleshooting.
alluxio-alluxio-csi-fuse-pvc in pending status
After creating the cluster, you might notice that alluxio-alluxio-csi-fuse-pvc is in the Pending status. This is normal. The PVC will automatically bind to a PV and its status will change to Bound when it is used by a client pod.
Unable to access public image registry
Configuring alluxio-operator image
Deploying the Alluxio operator requires pulling dependent images from an accessible image registry. If your network environment cannot access the public image registry, you will encounter a timeout error when pulling the images:
You may notice that the cluster controller, ufs controller and collectinfo controller have started successfully, but the csi controller and csi nodeplugin remain in the ContainerCreating state. This is due to a timeout while pulling the dependent images. By using kubectl describe pod to view detailed information, you will see error messages similar to the following:
You can download the dependent images locally, upload them to your private image registry, and then modify the image addresses in the alluxio-operator.yaml file before redeploying the operator.
operator CSI
registry.k8s.io/sig-storage/csi-node-driver-registrar
v2.0.0
csi driver registrar dependency
operator CSI
registry.k8s.io/sig-storage/csi-provisioner
v2.0.5
csi provisioner dependency
cluster ETCD
docker.io/bitnami/etcd
3.5.9-debian-11-r24
etcd dependency
cluster ETCD
docker.io/bitnami/os-shell
11-debian-11-r2
os-shell dependency
cluster monitor
grafana/grafana
10.4.5
Monitoring dashboard
cluster monitor
prom/prometheus
v2.52.0
Metrics collection
The commands to pull the Docker images and upload them to your private image registry are as follows:
Update the image addresses in the alluxio-operator/alluxio-operator.yaml file, adding the provisioner and driverRegistrar image addresses:
Move to the alluxio-operator directory and execute the following command to deploy the operator:
configuring Alluxio cluster image
Starting the Alluxio cluster also involves etcd and monitoring components. If you cannot access the public image registry, you need to replace the image addresses for etcd and monitoring components with those from your private image registry. Modify the image addresses in the alluxio-operator/alluxio-cluster.yaml file accordingly.
Last updated