Can we automate kubectl commands

you can put them all in 1 yaml file and just run the one command.