Skip to content

Latest commit

 

History

History
69 lines (52 loc) · 4.76 KB

gke-deploy_run.md

File metadata and controls

69 lines (52 loc) · 4.76 KB

gke-deploy run

Execute both prepare and apply phase

Synopsis

Deploy to GKE in two phases, which will do the following:

Prepare Phase:

  • Expand Kubernetes configuration files:
    • Set the digest of images that match the [--image|-i] flag, if provided.
    • Add app.kubernetes.io/name=[--app|-a] label, if provided.
    • Add app.kubernetes.io/version=[--version|-v] label, if provided.

Apply Phase:

  • Apply Kubernetes configuration files to the target cluster with the provided namespace.
  • Wait for deployed Kubernetes configuration files to be ready before exiting.
gke-deploy run [flags]

Examples

  # Expand Kubernetes configuration files and deploy to GKE cluster.
  gke-deploy run -f configs -i gcr.io/my-project/my-app:1.0.0 -a my-app -v 1.0.0 -o expanded -n my-namespace -c my-cluster -l us-east1-b

  # Deploy to GKE cluster that kubectl is currently targeting.
  gke-deploy run -f configs

  # Deploy to GKE cluster that kubectl is currently targeting without supplying any Kubernetes configuration files. Have gke-deploy generate suggested Kubernetes configuration files for your application using an image, app name, and service port.
  gke-deploy run -i nginx -a nginx -x 80

  # Pipe output from another templating engine to gke-deploy run.
  kustomize build overlays/staging | gke-deploy run -f - -a my-app -c my-cluster -l us-east1-b
  helm template charts/prometheus | gke-deploy run -f - -a prometheus -c my-cluster -l us-east1-b  # No need to run Tiller in cluster

Options

  -A, --annotation strings      Annotation(s) to add to Kubernetes configuration files (k1=v1). Annotations can be set comma-delimited or as separate flags. If two or more annotations with the same key are listed, the last one is used.
  -a, --app string              Application name of the Kubernetes deployment.
  -c, --cluster string          Name of GKE cluster to deploy to.
      --create-application-cr   Creates an Application CR object with the name provided by --app and connects to deployed objects using a selector that matches the label with key as 'app.kubernetes.io/name' and value specified by --app.
  -x, --expose int              Creates a Service object that connects to a deployed workload object using a selector that matches the label with key as 'app.kubernetes.io/name' and value specified by --app. The port provided will be used to expose the deployed workload object (i.e., port and targetPort will be set to the value provided in this flag).
  -f, --filename string         Local or GCS path to configuration file or directory of configuration files to use to create Kubernetes objects (file or files in directory must end in ".yml" or ".yaml"). Prefix this value with "gs://" to indicate a GCS path. If this field is not provided, a Deployment (with image provided by --image) and a HorizontalPodAutoscaler are created as suggested based configs. The application's name is inferred from the image name's suffix.
  -h, --help                    help for run
  -i, --image string            Image to be deployed.
  -L, --label strings           Label(s) to add to Kubernetes configuration files (k1=v1). Labels can be set comma-delimited or as separate flags. If two or more labels with the same key are listed, the last one is used.
      --links strings           Links(s) to add to the spec.descriptor.links field of an Application CR generated with the --create-application-cr flag or provided via the --filename flag (description=URL). Links can be set comma-delimited or as separate flags.
  -l, --location string         Region/zone of GKE cluster to deploy to.
  -n, --namespace string        Namespace of GKE cluster to deploy to. If omitted, the namespace(s) specified in each Kubernetes configuration file is used.
  -o, --output string           Target directory or GCS path to store suggested and expanded Kubernetes configuration files. Prefix this value with "gs://" to indicate a GCS path. Suggested files will be stored in "<output>/suggested" and expanded files will be stored in "<output>/expanded". (default "./output")
  -p, --project string          Project of GKE cluster to deploy to. If this field is not provided, the current set GCP project is used.
  -R, --recursive               Recursively search through the provided path in --filename for all YAML files.
  -D, --server-dry-run          Perform kubectl apply server dry run to validate configurations without persisting resources.
  -t, --timeout duration        Timeout limit for waiting for Kubernetes objects to finish applying. (default 5m0s)
  -V, --verbose                 Prints underlying commands being called to stdout.
  -v, --version string          Version of the Kubernetes deployment.

SEE ALSO

Auto generated by spf13/cobra on 2-Jun-2021