ks env add

Add a new environment to a ksonnet application

Synopsis

The add command creates a new environment (specifically for the ksonnet app
whose directory it’s executed in). This environment is cached with the following
info:

  1. Name — A string used to uniquely identify the environment.
  2. Server — The address and port of a Kubernetes API server (i.e. cluster).
  3. Namespace — A Kubernetes namespace. Must already exist on the cluster.
  4. Kubernetes API Version — Used to generate a library with compatible type defs.

(1) is mandatory. (2) and (3) can be inferred from $KUBECONFIG, or from the
--kubeconfig or --context flags. Otherwise, (2), (3), and (4) can all be
specified by individual flags. Unless otherwise specified, (4) defaults to the
latest Kubernetes version that ksonnet supports.

Note that an environment DOES NOT contain user-specific data such as private keys.

  • ks env list — List all environments in a ksonnet application
  • ks env rm — Delete an environment from a ksonnet application
  • ks env set — Set environment-specific fields (name, namespace, server)
  • ks param set — Set environment-specific fields (name, namespace, server)
  • ks apply — Apply local Kubernetes manifests (components) to remote clusters

Syntax

  1. ks env add <env-name> [flags]

Examples

  1. # Initialize a new environment, called "staging". No flags are set, so 'server'
  2. # and 'namespace' info are pulled from the file specified by $KUBECONFIG.
  3. # 'version' defaults to the latest that ksonnet supports.
  4. ks env add us-west/staging
  5. # Initialize a new environment called "us-west/staging" with the pre-existing
  6. # namespace 'staging'. 'version' is specified, so the OpenAPI spec from the
  7. # Kubernetes v1.7.1 build is used to generate the helper library 'ksonnet-lib'.
  8. #
  9. # NOTE: "us-west/staging" indicates a hierarchical structure, so the env-specific
  10. # files here are saved in "<ksonnet-app-root>/environments/us-west/staging".
  11. ks env add us-west/staging --api-spec=version:v1.7.1 --namespace=staging
  12. # Initialize a new environment "my-env" using the "dev" context in your current
  13. # kubeconfig file ($KUBECONFIG).
  14. ks env add my-env --context=dev
  15. # Initialize a new environment "prod" using the address of a cluster's Kubernetes
  16. # API server.
  17. ks env add prod --server=https://ksonnet-1.us-west.elb.amazonaws.com

Options

  1. --api-spec string Manually specify API version from OpenAPI schema, cluster, or Kubernetes version
  2. --as string Username to impersonate for the operation
  3. --as-group stringArray Group to impersonate for the operation, this flag can be repeated to specify multiple groups.
  4. --certificate-authority string Path to a cert file for the certificate authority
  5. --client-certificate string Path to a client certificate file for TLS
  6. --client-key string Path to a client key file for TLS
  7. --cluster string The name of the kubeconfig cluster to use
  8. --context string The name of the kubeconfig context to use
  9. -h, --help help for add
  10. --insecure-skip-tls-verify If true, the server's certificate will not be checked for validity. This will make your HTTPS connections insecure
  11. --kubeconfig string Path to a kubeconfig file. Alternative to env var $KUBECONFIG.
  12. -n, --namespace string If present, the namespace scope for this CLI request
  13. -o, --override Add environment as override
  14. --password string Password for basic authentication to the API server
  15. --request-timeout string The length of time to wait before giving up on a single server request. Non-zero values should contain a corresponding time unit (e.g. 1s, 2m, 3h). A value of zero means don't timeout requests. (default "0")
  16. --server string The address and port of the Kubernetes API server
  17. --token string Bearer token for authentication to the API server
  18. --user string The name of the kubeconfig user to use
  19. --username string Username for basic authentication to the API server

Options inherited from parent commands

  1. --dir string Ksonnet application root to use; Defaults to CWD
  2. --tls-skip-verify Skip verification of TLS server certificates
  3. -v, --verbose count Increase verbosity. May be given multiple times.

SEE ALSO

  • ks env - Manage ksonnet environments