Sha256: 3a6181ff89c1678dbdb3485a79883896b17aea1834c56e9ce29a69f285aea76c

Contents?: true

Size: 1.11 KB

Versions: 12

Compression:

Stored size: 1.11 KB

Contents

---
title: Kubectl Config
---

## General

Kubes calls out the `kubectl` command. You can customize the command.

## Args

Here are some examples of customizing the kubectl args.

.kubes/config/kubectl/args.rb

```ruby
command("apply",
  args: ["--validate=true"],
)

command("delete",
  args: ["--grace-period=-1"],
)
```

## Hooks

Here are some examples of running custom hooks before and after the kubectl commands.

.kubes/config/kubectl/hooks.rb

```ruby
before("apply",
  execute: "kubectl apply -f .kubes/shared/namespace.yaml",
)

after("delete",
  execute: "echo 'delete hook',
)
```

You can use hooks to do things that may not make sense to do in the `.kubes/resources` definition. Here's an example of automatically creating the namespace.

.kubes/shared/namespace.yaml

```yaml
apiVersion: v1
kind: Namespace
metadata:
  name: demo
```

### exit on fail

By default, if the hook commands fail, then terraspace will exit with the original hook error code.  You can change this behavior with the `exit_on_fail` option.

```ruby
before("apply"
  execute: "/command/will/fail/but/will/continue",
  exit_on_fail: false,
)
```

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
kubes-0.3.4 docs/_docs/config/kubectl.md
kubes-0.3.3 docs/_docs/config/kubectl.md
kubes-0.3.2 docs/_docs/config/kubectl.md
kubes-0.3.1 docs/_docs/config/kubectl.md
kubes-0.3.0 docs/_docs/config/kubectl.md
kubes-0.2.6 docs/_docs/config/kubectl.md
kubes-0.2.5 docs/_docs/config/kubectl.md
kubes-0.2.4 docs/_docs/config/kubectl.md
kubes-0.2.3 docs/_docs/config/kubectl.md
kubes-0.2.2 docs/_docs/config/kubectl.md
kubes-0.2.1 docs/_docs/config/kubectl.md
kubes-0.2.0 docs/_docs/config/kubectl.md