Is it possible to deploy to GKE Autopilot cluster without yaml and just command line? I have inherited a project where deployment generates command line to deploy to CloudRun. I am in the process of migrating from CloudRun to GKE Autopilot and I would like to not need to parse or generate yaml files just for the purpose of deploying a service to GKE Autopilot. Is there a way to deploy with just command line like I can with CloudRun?
Are you trying to expose the service outside the cluster? If so, public or private?
I think some of the services are going to be exposed with CloudIP and others would be exposed with LoadBalancer. However, I know exposing the service can be done by command line, but I couldn't find how to deploy the service by command line before that point.
So I found a basic command to deploy an image
kubectl create deployment <cluster-name> --image <image>
But I couldn't find way to include environment variables. Would I need to do the following after deployment:
kubectl set env rs <name of replicaset> "env1=value" "env2=value"
Would I need to terminate the running pod so that the next pod gets the new environment variable?
For simple deployments it is likely that you can use both command line and yaml files. For more complex workloads, you should probably consider just using manifests or yaml files as they are easier to read and maintain, are easier to manage via version control (infra as code), and are vendor neutral.
Most k8s docs are written with the yaml format, including the environment variable question you asked in this thread: https://kubernetes.io/docs/tasks/inject-data-application/environment-variable-expose-pod-information...