Can we automate kubectl commands

can we automate below steps and run in one step.

  1. Create namespace
  2. Assign SSL certificate
  3. assigning publicip for load balancer
  4. Creating ingress

So far I have been using YAML files and executing the steps manually. Please help in automating the steps.

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

what if I want to parameterize them…

you could convert it to helm chart. Then you have a parameters file that would hold all the values, then you would just do helm install and you can even do overrides on the command line and still do it all as one command.

Otherwise you may need to look in to something like spinnaker, gitlabs, or some other type of deployment system that you can provide the template yaml file and it will fill in the variables.