Using SCALE Apps
5 minute read.Last Modified 2021-05-03 08:51 EDT
Both pre-built official containers and custom application containers can be deployed using the Apps page in the Scale web interface.
The UI will ask to use a storage pool for Applications.
We recommend users keep the container use case in mind when choosing a pool. Select a pool that has enough space for all the application containers you intend to use. TrueNAS creates an ix-applications dataset on the chosen pool and uses it to store all container-related data.
You can find additional options for configuring general network interfaces and IP addresses for application containers in Apps > Settings > Advanced Settings.
Official containers are pre-configured to only require a name during deployment.
A button to open the application web interface will appear when the container is deployed and active.
Users can adjust the container settings by editing a deployed official container. Saving any changes redeploys the container.
To deploy a custom application container in the Scale web interface, go to Apps and click Launch Docker Image.
TrueNAS has numerous options for custom containers that are broken down into smaller sections. These options are derived from the Kubernetes container options.
Define any commands and arguments to use for the image. These can override any existing commands stored in the image.
You can also define additional environment variables for the container. Some Docker images can require additional environment variables. Be sure to check the documentation for the image you’re trying to deploy and add any required variables here.
To use the system IP address for the container, set Host Networking. The container will not be given a separate IP address and the container port number will be appended to the end of the system IP address. See the Docker documentation for more details.
Users can create additional network interfaces for the container if needed. Users can also give static IP addresses and routes to new interface.
By default, containers use the DNS settings from the host system. You can change the DNS policy and define separate nameservers and search domains. See the Docker DNS services documentation for more details.
Users can create additional Persistent Volumes (PV’s) for storage within the container. PV’s consume space from the pool chosen for Application management. You will need to name each new dataset and define a path where that dataset appears inside the container.
To view created container datasets, go to Storage and expand the pool used for applications.
Users developing applications should be mindful that if an application uses Persistent Volume Claims (PVC), those datasets won’t be mounted on the host, and therefore will not be accessible within a file browser. This is upstream zfs-localpv behavior which is being used for managing PVC(s)
If you want to consume or have file browser access to data that is present on the host, set up your custom application to use host path volumes.
Alternatively, you can use the network to copy directories and files to and from the pod using
k3s kubectl commands.
To copy from a pod in a specific container:
k3s kubectl cp <file-spec-src> <file-spec-dest> -c <specific-container>
To copy a local file to the remote pod:
k3s kubectl cp /tmp/foo <some-namespace>/<some-pod>:/tmp/bar
To copy a remote pod file locally:
k3s kubectl cp <some-namespace>/<some-pod>:/tmp/foo /tmp/bar
Saving an official or custom container adds a new entry to Installed Applications. The container enters a deploy status as it fetches the image from the remote repository and configures it. When deployment is complete, the container moves to an active status and can be used.
To access the shell in an active container, first identify the namespace and pod for the container. In the Scale UI, go to System Settings > Shell to begin entering commands:
- View container namespaces:
k3s kubectl get namespaces.
- View pods by namespace:
k3s kubectl get -n <NAMESPACE> pods.
- Access container shell:
k3s kubectl exec -n <NAMESPACE> --stdin --tty <POD> -- /bin/bash.
- View details about all containers:
k3s kubectl get pods,svc,daemonsets,deployments,statefulset,sc,pvc,ns,job --all-namespaces -o wide.
- Get container status:
k3s kubectl describe -n <CONTAINER NAMESPACE> <POD-ID>.