Skip to main content

Commands

Usage#

kosko <command>

Options#

--cwd#

Set path to the working directory. Default to the current working directory (CWD).

--silent#

Disable log output.

init#

Set up a new kosko directory.

kosko init [path]

Positionals#

path#

Path to initialize. Default to the current directory.

Options#

--force, -f#

Overwrite existing files.

generate#

Generate Kubernetes manifests.

kosko generate [components..]

Positionals#

components#

Components to generate. It can be either a component's name or a glob pattern). This overrides components set in the config file.

# Generate components set in kosko.tomlkosko generate
# Generate components with specified nameskosko generate foo bar
# Generate components matched to the glob patternkosko generate nginx_*

Options#

--env, -e#

Environment name.

--set, -s#

Override global environment variables on the command line KEY=VAL (can be used multiple times).

JSONPath Expressions are supported for keys, keys are prepdended with $. automatically. Value is converted to JSON object if it's possible; otherwise, it's handled as a string.

# Set multiple argumentskosko generate --set image.name=mysql --set image.tag=1.3.4
# Override entire arraykosko generate --set imagePullSecrets='[ { "name": "mySecret" } ]'
# Set name of the first item in the arraykosko generate --set imagePullSecrets[0].name=mySecret
# Override value of item of the "secrets"# array that has "secretKey" in the "name" fieldkosko generate --set secrets[?(@.name=="secretKey")].value=secretValue
# Disable deployment of the database, value is parsed as a booleankosko generate --set mysql.enabled=false
# Set myService to the "true" string, quotes must be escaped because of shellkosko generate --set myService=\'true\'
# Set myService to the "true" string using quotes inside of the other quotskosko generate --set myService='"true"'

--set.<component>, -s.<component>#

Override variables of the specified component. Format is the same as in the --set argument. Component overrides are always applied after the global ones regardless of an order of arguments in the command line.

# Set mysql port to 3307 for all components and 3308 only for the "backend" componentkosko generate --set.backend mysql.port=3308 --set mysql.port=3307

--require, -r#

Require external modules. Modules set in the config file will also be required.

# Using TypeScriptkosko generate -r ts-node/register

--output, -o#

Output format. The value can be yaml or json. Default to yaml.

--validate#

Validate components. It is enabled by default. It can be disabled by setting --no-validate or --validate=false.

Examples#

# Print components to consolekosko generate
# Apply to Kubernetes clusterkosko generate | kubectl apply -f -

validate#

Validate components.

kosko validate [components..]

Positionals#

components#

Components to generate. It can be either a component's name or a glob pattern). This overrides components set in the config file.

# Generate components set in kosko.tomlkosko validate
# Generate components with specified nameskosko validate foo bar
# Generate components matched to the glob patternkosko validate nginx_*

Options#

--env, -e#

Environment name.

--set, -s, --set.<component>, -s.<component>#

Override global or component variables on the command line KEY=VAL (can be used multiple times). See decription of the generate command for more details.

--require, -r#

Require external modules. Modules set in the config file will also be required.

# Using TypeScriptkosko validate -r ts-node/register

migrate#

Migrate Kubernetes YAML into kosko components.

kosko migrate

Options#

--filename, -f#

File, directory or stdin to migrate.

# Read from a file or a directorykosko migrate -f path/to/file
# Read from stdinkosko migrate -f -

Examples#

kosko migrate -f nginx.yml > components/nginx.js