Skip to content
Snippets Groups Projects
Code owners
Assign users and groups as approvers for specific file changes. Learn more.

ks init

Initialize a ksonnet project

Synopsis

Initialize a ksonnet project in a new directory, app-name. This process consists of two steps:

  1. Generating ksonnet-lib. Users can set flags to generate the library based on a variety of data, including server configuration and an OpenAPI specification of a Kubernetes build. By default, this is generated from the capabilities of the cluster specified in the cluster of the current context specified in $KUBECONFIG.

  2. Generating the following tree in the current directory.

     app-name/
       .gitignore     Default .gitignore; can customize VCS
       .ksonnet/      Metadata for ksonnet
       environments/
         default/      [Default generated environment]
       components/    Top-level Kubernetes objects defining application
       lib/           user-written .libsonnet files
       vendor/        part libraries, prototypes
ks init <app-name>

Examples

# Initialize ksonnet application, using the capabilities of live cluster
# specified in the $KUBECONFIG environment variable (specifically: the
# current context) to generate 'ksonnet-lib'.
ks init app-name

# Initialize ksonnet application, using the OpenAPI specification generated
# in the Kubenetes v1.7.1 build to generate 'ksonnet-lib'.
ks init app-name --api-spec=version:v1.7.1

# Initialize ksonnet application, using an OpenAPI specification file
# generated by a build of Kubernetes to generate 'ksonnet-lib'.
ks init app-name --api-spec=file:swagger.json

# Initialize ksonnet application, using the context 'dev' from the kubeconfig
# file.
ks init app-name --context=dev

Options

      --api-spec string                Manually specify API version from OpenAPI schema, cluster, or Kubernetes version (default "version:v1.7.0")
      --as string                      Username to impersonate for the operation
      --certificate-authority string   Path to a cert. file for the certificate authority
      --client-certificate string      Path to a client certificate file for TLS
      --client-key string              Path to a client key file for TLS
      --cluster string                 The name of the kubeconfig cluster to use
      --context string                 The name of the kubeconfig context to use
      --insecure-skip-tls-verify       If true, the server's certificate will not be checked for validity. This will make your HTTPS connections insecure
      --kubeconfig string              Path to a kube config. Only required if out-of-cluster
  -n, --namespace string               If present, the namespace scope for this CLI request
      --password string                Password for basic authentication to the API server
      --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")
      --server string                  The address and port of the Kubernetes API server
      --token string                   Bearer token for authentication to the API server
      --user string                    The name of the kubeconfig user to use
      --username string                Username for basic authentication to the API server

Options inherited from parent commands

  -v, --verbose count[=-1]   Increase verbosity. May be given multiple times.

SEE ALSO

  • ks - Synchronise Kubernetes resources with config files