How to run a Docker container on SCALE for dummies?

Patrick M. Hausen

Hall of Famer
Joined
Nov 25, 2013
Messages
7,776
Hi all,

is there a write up already on how to do this? No large orchestration (k8s) needed. What would I have to do given a docker-compose.yml to run it on SCALE in a way that will keep the settings across updates and restart the container on reboot?

Not familiar with that "helm" thing, either - never heard of it, tbh.

Thanks,
Patrick
 

Ericloewe

Server Wrangler
Moderator
Joined
Feb 15, 2014
Messages
20,194
I imagine that a startup script to the effect of:
Code:
cd /path/to/compose-file && docker-compose start

Should be a decent starting point, if no formal way of accomplishing this exists yet.
Settings would either be in the compose file itself or in a mounted directory and so should be unaffected by updates of the system.
 

morganL

Captain Morgan
Administrator
Moderator
iXsystems
Joined
Mar 10, 2018
Messages
2,694
is there a write up already on how to do this? No large orchestration (k8s) needed. What would I have to do given a docker-compose.yml to run it on SCALE in a way that will keep the settings across updates and restart the container on reboot?

Not familiar with that "helm" thing, either - never heard of it, tbh.

Helm is a Kubernetes package manager. https://helm.sh/
Helm charts describe the software to be deployed and help with version control. The simplest Helm chart is a single Docker container. More complex ones have many containers for a whole application like a web server. The Helm charts are describer here. https://helm.sh/docs/topics/charts/

So, the plan is for TrueNAS SCALE to automate the process of getting a Docker container and creating a helm chart.... or to deploy a helm chart that is already created . This can recreate the plugin experience.

There is a plan to document the simpler Docker container case in the release or developer notes. Unlike the VM UI, the Kubernetes UI is still in development.
 

Patrick M. Hausen

Hall of Famer
Joined
Nov 25, 2013
Messages
7,776
That's what I currently do on Core for two containers. Ubuntu-VMs, Docker compose, auto update via cron job.

I got the impression that among other things Scale was supposed to be a Docker platform. So surely it must be way simpler to just deploy some containers on Scale? And I could remove two VMs from my main NAS ...

Kind regards,
Patrick
 

morganL

Captain Morgan
Administrator
Moderator
iXsystems
Joined
Mar 10, 2018
Messages
2,694
Yes, SCALE will be a better container platform... including Docker containers. The infrastructure will be Kubernetes....its much more scalable and flexible. The UI will be simple and hide much of the complexity.
 

Patrick M. Hausen

Hall of Famer
Joined
Nov 25, 2013
Messages
7,776
OK, so I'll just wait for now. The small Atom based system runs great as a combined ESXi/SCALE host. VM datastore for the ESXi on my main NAS via iSCSI. Storage for SCALE via PCI passthrough.
 

antsh

Cadet
Joined
Jun 26, 2013
Messages
7
I haven't actually tried it yet, but it looks like docker-compose already comes pre-installed. Wouldn't just doing docker-compose up -d do the trick? If the containers' policies in the compose file are defined as restart always or restart unless stopped I would think they would come back up automatically after a reboot.

I can try in a bit to confirm
 

antsh

Cadet
Joined
Jun 26, 2013
Messages
7
Yup, so I can confirm that works. The one other thing I did was to ensure that the docker service was running, and would be started every boot. So just do systemctl enable docker. Then write your docker-compose.yml file and save it. Run docker-compose up -d and your containers should come up. If they are defined as restart-always or restart-unless-stopped they will survive reboots. I just did a quick test by installing portainer using a docker-compose file and it came right back up after rebooting. This was all in a Truenas SCALE VM inside of Debian.
 

KrisBee

Wizard
Joined
Mar 20, 2017
Messages
1,288
@antsh et all Don't you need to keep docker /var/lib/docker stuff of your boot pool by creating a /etc/docker/daemon.json with a new "data-root" pointing to your pool? Or, alternatively editing the /lib/systemd/system/docker.service. I assume this would be something that would end up in the UI. For singe node use, I'd like to see a choice between docker only and k8s/k3s but it sounds like the aim is kubernetes with the added complexity over a docker stack.
 

SillyPosition

Dabbler
Joined
Dec 31, 2018
Messages
20
Yes, SCALE will be a better container platform... including Docker containers. The infrastructure will be Kubernetes....its much more scalable and flexible. The UI will be simple and hide much of the complexity.
Is there a place that describes the technical aspect of how Freenas is going to install K8s, how its going to be available to the user?
If Im already familiar with kubernetes, do I have to use some simplistic UI for things, or can I also simply manage k8s directly via kubectl commands and deploy things myself, will it work normally?
 

morganL

Captain Morgan
Administrator
Moderator
iXsystems
Joined
Mar 10, 2018
Messages
2,694
Is there a place that describes the technical aspect of how Freenas is going to install K8s, how its going to be available to the user?
If Im already familiar with kubernetes, do I have to use some simplistic UI for things, or can I also simply manage k8s directly via kubectl commands and deploy things myself, will it work normally?

TrueNAS SCALE includes Kubernetes (K3s).. you just enable it as a service (simplistic UI). Once running, most of the APIs and CLIs can be accessed. Try it out and let us know whether there are any issues.
 

majerus

Contributor
Joined
Dec 21, 2012
Messages
126
@morganL Should kubernetes be an option to enable from this screen?


1603573319507.png
 

KrisBee

Wizard
Joined
Mar 20, 2017
Messages
1,288
@morganL Is there a "midclt call -job kubernetes." to remove or disable kubernetes after you've used midclt call -job kubernetes.update '{"pool": "pool_name_here"}' ?
 

Patrick M. Hausen

Hall of Famer
Joined
Nov 25, 2013
Messages
7,776
I am making some progress, but now I think I need a nudge in the right direction, again.

Per the developer notes I did midclt call -job kubernetes.update '{"pool": "ssd"}' and added the suggested shell aliases.

Then I found out about Helm and the hub now at https://artifacthub.io.
Searching for OnlyOffice resulted in https://artifacthub.io/packages/helm/kfirfer/onlyoffice.

So I did helm repo add kfirfer https://kfirfer.github.io/helm/. Then I tried to install OnlyOffice.
Code:
truenas# helm install onlyoffice kfirfer/onlyoffice
NAME: onlyoffice
LAST DEPLOYED: Sun Oct 25 06:21:09 2020
NAMESPACE: default
STATUS: deployed
REVISION: 1
NOTES:
1. Get the application URL by running these commands:
  export POD_NAME=$(kubectl get pods --namespace default -l "app.kubernetes.io/name=onlyoffice,app.kubernetes.io/instance=onlyoffice" -o jsonpath="{.items[0].metadata.name}")
  echo "Visit http://127.0.0.1:9980 to use your application"
  kubectl port-forward $POD_NAME 9980:9980


When I try to execute the commands at the bottom I am now stuck here:
Code:
truenas# export POD_NAME=$(kubectl get pods --namespace default -l "app.kubernetes.io/name=onlyoffice,app.kubernetes.io/instance=onlyoffice" -o jsonpath="{.items[0].metadata.name}")
truenas# kubectl port-forward $POD_NAME 9980:9980
error: unable to forward port because pod is not running. Current status=Pending


And I don't have a clue what that means.

Thanks!
Patrick
 

KrisBee

Wizard
Joined
Mar 20, 2017
Messages
1,288
@Patrick M. Hausen Doesn't it say use "helm install my-onlyoffice kfirfer/onlyoffice --version 1.0.0" for Helm v3? But otherwise the entry at the hub simply says "You can also add additional flags to the helm install command if you need to." Not too helpful.

My clusterology has not got much past the basics but an onlyoffice/document server docker has got a lot of options so how are these reflected in a helm chart?

Anyway, a "kubectl get pod -A -o wide" should show you all the pods running in your cluster.
 

Patrick M. Hausen

Hall of Famer
Joined
Nov 25, 2013
Messages
7,776
@KrisBee That's what I more or less did, wasn't it?

my-onlyoffice is just an arbitrary local name - for which I picked onlyoffice.
kfirfer/onlyoffice I used the same way and it did download and install something.

I left out the --version part - is that strictly necessary? There is only one version of that thing (what is it called? a pod?) in the repo, currently.

Code:
truenas# kubectl get pod -A -o wide
NAMESPACE     NAME                          READY   STATUS    RESTARTS   AGE     IP       NODE     NOMINATED NODE   READINESS GATES
kube-system   openebs-zfs-controller-0      0/5     Pending   0          5h20m   <none>   <none>   <none>           <none>
kube-system   coredns-66c464876b-hsz46      0/1     Pending   0          5h20m   <none>   <none>   <none>           <none>
default       onlyoffice-57c7b978d7-42q6g   0/1     Pending   0          4h46m   <none>   <none>   <none>           <none>


Thanks!
Patrick
 

KrisBee

Wizard
Joined
Mar 20, 2017
Messages
1,288
I mistakenly thought your helm chart had not installed. But is your cluster healthy? I would have expected to see "running" as the status, eg

Code:
root@truenas:~#   kubectl get pods -A -o wide                         
NAMESPACE     NAME                                        READY   STATUS    RESTARTS   AGE    IP             NODE         NOMINATED NODE   READINESS GATES
kube-system   openebs-zfs-node-h7njp                      2/2     Running   25         3d8h   192.168.1.25   ix-truenas   <none>           <none>
kube-system   openebs-zfs-controller-0                    5/5     Running   75         3d8h   172.16.0.26    ix-truenas   <none>           <none>
kube-system   coredns-66c464876b-h4g69                    1/1     Running   12         3d8h   172.16.0.27    ix-truenas   <none>           <none>
kube-system   nginx-ingress-controller-5cd8cdf889-46dfp   1/1     Running   0          104m   172.16.0.28    ix-truenas   <none>           <none>
default       my-onlyoffice-57cd4559f8-r9hkf              1/1     Running   0          93m    172.16.0.30    ix-truenas   <none>           <none>
root@truenas:~# 


( you can igonre the ingress, that's me trying out helm)

and for services:

Code:
root@truenas:~# kubectl get svc -A -o wide
NAMESPACE     NAME            TYPE        CLUSTER-IP     EXTERNAL-IP   PORT(S)                  AGE    SELECTOR
default       kubernetes      ClusterIP   172.17.0.1     <none>        443/TCP                  3d8h   <none>
kube-system   kube-dns        ClusterIP   172.17.0.10    <none>        53/UDP,53/TCP,9153/TCP   3d8h   k8s-app=kube-dns
default       my-onlyoffice   ClusterIP   172.17.249.6   <none>        80/TCP                   95m    app.kubernetes.io/instance=my-onlyoffice,app.kubernetes.io/name=onlyoffice
root@truenas:~#


Perhaps check "kubectl get all -n kube-system" output and docker ps on your system.

Next questions is how to access http://127.0.0.1:9980 after using the kubectl port-foward command
 
Top