2

I am writing a bash file where I wrote some scripts to install the spinnaker in Kubernetes cluster (minikube) everything is working fine, the spinnaker is installed now but when I come inside the halyard and want to run few scripts from my bash file then it is coming inside my halyard container but not executing the next commands because I don't know how to run the multiple commands under it. I tried \ and && as well but not working. These are my commands

kubectl exec --namespace spinnaker -it spinnaker-spinnaker-halyard-0 bash 
hal config features edit --artifacts true 
hal config artifact github enable 
GITHUB_ACCOUNT_NAME=github_user 
hal config artifact github account add ${GITHUB_ACCOUNT_NAME} \
  --token
hal deploy apply

if I try kubectl exec --namespace spinnaker -it spinnaker-spinnaker-halyard-0 bash \ then it is running the next command (hal config features edit --artifacts true ) but it is showing error "--unknown flag --artifacts".

NOTE: If I run these command manually in the CLI then everything works fine but I want to run these commands from my bash file.

Monika Rani
  • 811
  • 1
  • 6
  • 10

1 Answers1

0

I'm assuming the commands that you want to run are not stored in a file in the container. If you add these commands to a script file(e.g. config-halyard.sh), and mount a persistent volume to the Halyard container(containing this script), you should be able to execute it from outside the container with this command:

kubectl exec --namespace spinnaker -it spinnaker-spinnaker-halyard-0 /bin/bash config-halyard.sh

That is assuming that the script would be in the container's root directory

grizzthedj
  • 7,131
  • 16
  • 42
  • 62