How to start an app from a shell

gordon19284

Dabbler
Joined
Dec 13, 2021
Messages
14
I'm sure this is straightforward but I'm still very new to Kubernetes. I have an app set up and ready to go, and I want to be able to SSH in and start it using the existing configuration without using the web UI.
 

aussiejuggalo

Explorer
Joined
Apr 26, 2016
Messages
50
I could be wrong but I'm pretty sure you cant do much from CLI as far as Kubernetes / Helm is concerned.

IX prefers you to use the GUI so if anything goes wrong they can provide support. FreeNAS, Core & Scale are pretty locked down.
 

sretalla

Powered by Neutrality
Moderator
Joined
Jan 1, 2016
Messages
9,700
I have an app set up and ready to go, and I want to be able to SSH in and start it using the existing configuration without using the web UI.
What you're probably wanting/needing is the API call using the middleware...

The one I think is relevant would be:

midclt call chart.release.scale ...

Seems to me the arguments would be '{ "release_name": appname, "scale_options.replica_count": 0 }'

But for the life of me, I can't seem to get that to work... maybe someone from iX can step in and point out the elusive correct syntax.

Obviously the scale of 0 is to stop it... (which is what the stop button does in kubernetes terms... scaling the app to 0 replicas), so 1 would be to start it.
 

adorobis

Dabbler
Joined
Oct 16, 2017
Messages
27
Accessing the Shell in an Active Container
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:

  1. View container namespaces: k3s kubectl get namespaces.
  2. View pods by namespace: k3s kubectl get -n <NAMESPACE> pods.
  3. Access container shell: k3s kubectl exec -n <NAMESPACE> --stdin --tty <POD> -- /bin/bash.
from: https://www.truenas.com/community/threads/accessing-a-container-from-the-cli.95733/
 

sretalla

Powered by Neutrality
Moderator
Joined
Jan 1, 2016
Messages
9,700
Accessing the Shell in an Active Container
That's good information (coming from a reliable source ;) ), but it doesn't answer the question that was asked.

What is desired is to start or stop an "App" from the CLI, not how to connect to the SSH console of that "App"'s container.
 

adorobis

Dabbler
Joined
Oct 16, 2017
Messages
27
Oh, sorry, didn't pay attention to detail :) I have found some info here but I could not make it work so far as I can't see any deployments for my app.
 

adorobis

Dabbler
Joined
Oct 16, 2017
Messages
27
@ksimm1 many thanks, works perfectly!
 

sretalla

Powered by Neutrality
Moderator
Joined
Jan 1, 2016
Messages
9,700
midclt call chart.release.scale [appname] '{"replica_count": 1}'
Can't seem to make it work... can you share how you identified the appname?
 

adorobis

Dabbler
Joined
Oct 16, 2017
Messages
27
how you identified the appname
In my case this is exactly the name I have defined in the Apps config
1649327495592.png
 

sretalla

Powered by Neutrality
Moderator
Joined
Jan 1, 2016
Messages
9,700
Well, I tried with that... and with variations with ix-appname and appname-595b7ff775-qwst7, no cigar (at least not for me... good it works for you).
 

adorobis

Dabbler
Joined
Oct 16, 2017
Messages
27
You can try to see if it has a different name listing all services: k3s kubectl get service --all-namespaces
 

sretalla

Powered by Neutrality
Moderator
Joined
Jan 1, 2016
Messages
9,700
You can try to see if it has a different name listing all services: k3s kubectl get service --all-namespaces
That just gives me back appname and ix-appname. I had already used k3s kubectl get pods,svc,daemonsets,deployments,statefulset,sc,pvc,ns,job --all-namespaces -o wide . Thanks for the thought though.
 
Top