kubes 0.4.4 → 0.5.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +21 -0
- data/README.md +1 -1
- data/docs/_docs/config/reference.md +1 -0
- data/docs/_docs/config/skip.md +1 -1
- data/docs/_docs/dsl/multiple-resources.md +3 -3
- data/docs/_docs/dsl/resources/job.md +62 -0
- data/docs/_docs/extra-env/dsl.md +2 -2
- data/docs/_docs/extra-env/yaml.md +1 -1
- data/docs/_docs/generators.md +41 -0
- data/docs/_docs/helpers.md +10 -3
- data/docs/_docs/helpers/aws.md +15 -0
- data/docs/_docs/helpers/aws/iam-role.md +91 -0
- data/docs/_docs/helpers/aws/secrets.md +129 -0
- data/docs/_docs/helpers/aws/ssm.md +76 -0
- data/docs/_docs/helpers/custom.md +40 -0
- data/docs/_docs/helpers/google.md +17 -0
- data/docs/_docs/helpers/google/secrets.md +76 -0
- data/docs/_docs/helpers/google/service-account.md +60 -0
- data/docs/_docs/intro.md +3 -1
- data/docs/_docs/intro/docker-image.md +66 -0
- data/docs/_docs/intro/how-kubes-works.md +7 -11
- data/docs/_docs/layering/merge.md +1 -1
- data/docs/_docs/learn/dsl/delete.md +10 -2
- data/docs/_docs/learn/dsl/review-project.md +2 -2
- data/docs/_docs/learn/yaml/delete.md +10 -2
- data/docs/_docs/learn/yaml/review-project.md +2 -2
- data/docs/_docs/patterns/clock-web-worker.md +3 -3
- data/docs/_docs/patterns/migrations.md +1 -1
- data/docs/_docs/patterns/secrets.md +0 -2
- data/docs/_docs/yaml.md +2 -2
- data/docs/_includes/commands.html +2 -2
- data/docs/_includes/helpers/base64.md +1 -0
- data/docs/_includes/sidebar.html +23 -1
- data/docs/_reference/kubes-delete.md +1 -1
- data/docs/_reference/kubes-exec.md +17 -1
- data/docs/_reference/kubes-init.md +2 -2
- data/docs/_reference/kubes-logs.md +2 -1
- data/docs/_reference/kubes-new.md +58 -0
- data/docs/_reference/kubes-prune.md +22 -0
- data/docs/reference.md +2 -0
- data/kubes.gemspec +1 -0
- data/lib/kubes.rb +2 -0
- data/lib/kubes/autoloader.rb +9 -0
- data/lib/kubes/cli.rb +9 -1
- data/lib/kubes/cli/build.rb +6 -0
- data/lib/kubes/cli/compile.rb +7 -0
- data/lib/kubes/cli/deploy.rb +1 -6
- data/lib/kubes/cli/exec.rb +5 -1
- data/lib/kubes/cli/help/exec.md +15 -0
- data/lib/kubes/cli/help/new.md +30 -0
- data/lib/kubes/cli/init.rb +1 -1
- data/lib/kubes/cli/new.rb +97 -0
- data/lib/kubes/cli/sequence.rb +1 -0
- data/lib/kubes/command.rb +7 -0
- data/lib/kubes/compiler.rb +19 -21
- data/lib/kubes/compiler/dsl/syntax/job.rb +217 -0
- data/lib/kubes/compiler/shared/custom_helpers.rb +17 -0
- data/lib/kubes/compiler/shared/helpers.rb +12 -3
- data/lib/kubes/compiler/shared/helpers/deprecated.rb +37 -0
- data/lib/kubes/compiler/strategy/base.rb +1 -0
- data/lib/kubes/compiler/strategy/dsl.rb +1 -0
- data/lib/kubes/compiler/strategy/erb.rb +2 -0
- data/lib/kubes/config.rb +1 -1
- data/lib/kubes/core.rb +6 -0
- data/lib/kubes/docker/strategy/image_name.rb +1 -1
- data/lib/kubes/kubectl.rb +5 -23
- data/lib/kubes/kubectl/batch.rb +27 -33
- data/lib/kubes/kubectl/ordering.rb +42 -0
- data/lib/kubes/version.rb +1 -1
- data/lib/templates/base/.kubes/config.rb.tt +1 -1
- data/lib/templates/base/.kubes/config/env/dev.rb +1 -1
- data/lib/templates/base/.kubes/config/env/prod.rb +1 -1
- data/lib/templates/dsl/.kubes/resources/web/deployment.rb +1 -1
- data/lib/templates/new/dsl/backend_config.rb +10 -0
- data/lib/templates/new/dsl/config_map.rb +5 -0
- data/lib/templates/new/dsl/daemon_set.rb +11 -0
- data/lib/templates/new/dsl/deployment.rb +4 -0
- data/lib/templates/new/dsl/ingress.rb +3 -0
- data/lib/templates/new/dsl/job.rb +2 -0
- data/lib/templates/new/dsl/managed_certificate.rb +2 -0
- data/lib/templates/new/dsl/namespace.rb +2 -0
- data/lib/templates/new/dsl/network_policy.rb +7 -0
- data/lib/templates/new/dsl/pod.rb +6 -0
- data/lib/templates/new/dsl/role.rb +4 -0
- data/lib/templates/new/dsl/role_binding.rb +7 -0
- data/lib/templates/new/dsl/secret.rb +5 -0
- data/lib/templates/new/dsl/service.rb +2 -0
- data/lib/templates/new/dsl/service_account.rb +1 -0
- data/lib/templates/new/yaml/backend_config.yaml +10 -0
- data/lib/templates/new/yaml/config_map.yaml +9 -0
- data/lib/templates/new/yaml/daemon_set.yaml +11 -0
- data/lib/templates/new/yaml/deployment.yaml +19 -0
- data/lib/templates/new/yaml/ingress.yaml +12 -0
- data/lib/templates/new/yaml/job.yaml +19 -0
- data/lib/templates/new/yaml/managed_certificate.yaml +7 -0
- data/lib/templates/new/yaml/namespace.yaml +6 -0
- data/lib/templates/new/yaml/network_policy.yaml +20 -0
- data/lib/templates/new/yaml/pod.yaml +11 -0
- data/lib/templates/new/yaml/role.yaml +13 -0
- data/lib/templates/new/yaml/role_binding.yaml +11 -0
- data/lib/templates/new/yaml/secret.yaml +9 -0
- data/lib/templates/new/yaml/service.yaml +14 -0
- data/lib/templates/new/yaml/service_account.yaml +4 -0
- data/lib/templates/yaml/.kubes/resources/base/all.yaml.tt +2 -0
- data/lib/templates/yaml/.kubes/resources/web/deployment.yaml.tt +1 -1
- data/spec/kubes/cli/prune_spec.rb +1 -0
- data/spec/kubes/compiler_spec.rb +5 -1
- metadata +65 -2
@@ -0,0 +1,76 @@
|
|
1
|
+
---
|
2
|
+
title: AWS SSM Parameters
|
3
|
+
nav_text: SSM
|
4
|
+
categories: helpers-aws
|
5
|
+
---
|
6
|
+
|
7
|
+
For example if you have these secret values:
|
8
|
+
|
9
|
+
$ aws ssm get-parameter --name /demo/development/db_user --with-decryption | jq '.Parameter.Value'
|
10
|
+
user
|
11
|
+
$ aws ssm get-parameter --name /demo/development/db_pass --with-decryption | jq '.Parameter.Value'
|
12
|
+
pass
|
13
|
+
|
14
|
+
Set up a [Kubes hook](https://kubes.guru/docs/config/hooks/kubes/).
|
15
|
+
|
16
|
+
.kubes/config/hooks/kubes.rb
|
17
|
+
|
18
|
+
```ruby
|
19
|
+
ssm = KubesAws::SSM.new(upcase: true, prefix: "/demo/development/")
|
20
|
+
before("compile",
|
21
|
+
label: "Get secrets from AWS SSM Manager",
|
22
|
+
execute: ssm,
|
23
|
+
)
|
24
|
+
```
|
25
|
+
|
26
|
+
Then set the secrets in the YAML:
|
27
|
+
|
28
|
+
.kubes/resources/shared/secret.yaml
|
29
|
+
|
30
|
+
```yaml
|
31
|
+
apiVersion: v1
|
32
|
+
kind: Secret
|
33
|
+
metadata:
|
34
|
+
name: demo
|
35
|
+
labels:
|
36
|
+
app: demo
|
37
|
+
data:
|
38
|
+
<% KubesAws::SSM.data.each do |k,v| -%>
|
39
|
+
<%= k %>: <%= base64(v) %>
|
40
|
+
<% end -%>
|
41
|
+
```
|
42
|
+
|
43
|
+
This results in AWS secrets with the prefix the `demo/dev/` being added to the Kubernetes secret data. The values are automatically base64 encoded. Produces:
|
44
|
+
|
45
|
+
.kubes/output/shared/secret.yaml
|
46
|
+
|
47
|
+
```yaml
|
48
|
+
metadata:
|
49
|
+
namespace: demo
|
50
|
+
name: demo-2a78a13682
|
51
|
+
labels:
|
52
|
+
app: demo
|
53
|
+
apiVersion: v1
|
54
|
+
kind: Secret
|
55
|
+
data:
|
56
|
+
db_pass: dGVzdDEK
|
57
|
+
db_user: dGVzdDIK
|
58
|
+
```
|
59
|
+
|
60
|
+
## Variables
|
61
|
+
|
62
|
+
These environment variables can be set:
|
63
|
+
|
64
|
+
Name | Description
|
65
|
+
---|---
|
66
|
+
AWS_SSM_PREFIX | Prefixed used to list and filter AWS SSM Parameters. IE: `demo/dev/`.
|
67
|
+
|
68
|
+
Secrets#initialize options:
|
69
|
+
|
70
|
+
Variable | Description | Default
|
71
|
+
---|---|---
|
72
|
+
base64 | Automatically base64 encode the values. | false
|
73
|
+
upcase | Automatically upcase the Kubernetes secret data keys. | false
|
74
|
+
prefix | Prefixed used to list and filter AWS secrets. IE: `demo/dev/`. Can also be set with the `AWS_SECRET_PREFIX` env variable. The env variable takes the highest precedence. | nil
|
75
|
+
|
76
|
+
{% include helpers/base64.md %}
|
@@ -0,0 +1,40 @@
|
|
1
|
+
---
|
2
|
+
title: Custom Helpers
|
3
|
+
---
|
4
|
+
|
5
|
+
Kubes ships with several built-in helpers. On top of this, you can define your own custom helpers. This allows you to define new methods and customize Kubes further.
|
6
|
+
|
7
|
+
## Example
|
8
|
+
|
9
|
+
You define custom helpers in the `.kubes/helpers` folder.
|
10
|
+
|
11
|
+
.kubes/helpers/my_helpers.rb
|
12
|
+
|
13
|
+
```ruby
|
14
|
+
module MyHelpers
|
15
|
+
def database_endpoint
|
16
|
+
case Kubes.env
|
17
|
+
when "dev"
|
18
|
+
"dev-db.cbuqdmc3nqvb.us-west-2.rds.amazonaws.com"
|
19
|
+
when "prod"
|
20
|
+
"prod-db.cbuqdmc3nqvb.us-west-2.rds.amazonaws.com"
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
```
|
25
|
+
|
26
|
+
The `database_endpoint` will be available to use in the `.kubes/resources` YAML files. IE:
|
27
|
+
|
28
|
+
.kubes/helpers/resources/shared/config_map.yaml
|
29
|
+
|
30
|
+
```yaml
|
31
|
+
apiVersion: v1
|
32
|
+
kind: ConfigMap
|
33
|
+
metadata:
|
34
|
+
name: demo
|
35
|
+
labels:
|
36
|
+
app: demo
|
37
|
+
data:
|
38
|
+
DATABASE_ENDPOINT: <%= database_endpoint %>
|
39
|
+
```
|
40
|
+
|
@@ -0,0 +1,17 @@
|
|
1
|
+
---
|
2
|
+
title: Google Helpers
|
3
|
+
---
|
4
|
+
|
5
|
+
List of Google helpers:
|
6
|
+
|
7
|
+
{% assign docs = site.docs | where: "categories","helpers-aws" %}
|
8
|
+
{% for doc in docs -%}
|
9
|
+
* [{{ doc.nav_text }}]({{ doc.url }})
|
10
|
+
{% endfor %}
|
11
|
+
|
12
|
+
## Notes
|
13
|
+
|
14
|
+
* By default, `KubeGoogle.logger = Kubes.logger`. This means, you can set `logger.level = "debug"` in `.kubes/config.rb` to see more details.
|
15
|
+
* The `gcloud` cli is used to create IAM roles. So `gcloud` is required.
|
16
|
+
* Note: Would like to use the google sdk, but it wasn't obvious how to do so. PRs are welcomed.
|
17
|
+
* The Google helpers are provided by the [boltops-tools/kubes_google](https://github.com/boltops-tools/kubes_google) library.
|
@@ -0,0 +1,76 @@
|
|
1
|
+
---
|
2
|
+
title: Google Secrets
|
3
|
+
nav_text: Secrets
|
4
|
+
categories: helpers-google
|
5
|
+
---
|
6
|
+
|
7
|
+
Set up a [Kubes hook](https://kubes.guru/docs/config/hooks/kubes/).
|
8
|
+
|
9
|
+
.kubes/config/hooks/kubes.rb
|
10
|
+
|
11
|
+
```ruby
|
12
|
+
before("compile",
|
13
|
+
execute: KubesGoogle::Secrets.new(upcase: true, prefix: 'projects/686010496118/secrets/demo-dev-')
|
14
|
+
)
|
15
|
+
```
|
16
|
+
|
17
|
+
Then set the secrets in the YAML:
|
18
|
+
|
19
|
+
.kubes/resources/shared/secret.yaml
|
20
|
+
|
21
|
+
```yaml
|
22
|
+
apiVersion: v1
|
23
|
+
kind: Secret
|
24
|
+
metadata:
|
25
|
+
name: demo
|
26
|
+
labels:
|
27
|
+
app: demo
|
28
|
+
data:
|
29
|
+
<% KubesGoogle::Secrets.data.each do |k,v| -%>
|
30
|
+
<%= k %>: <%= base64(v) %>
|
31
|
+
<% end -%>
|
32
|
+
```
|
33
|
+
|
34
|
+
This results in Google secrets with the prefix the `demo-dev-` being added to the Kubernetes secret data. The values are automatically base64 encoded.
|
35
|
+
|
36
|
+
For example if you have these secret values:
|
37
|
+
|
38
|
+
$ gcloud secrets versions access latest --secret demo-dev-db_user
|
39
|
+
test1
|
40
|
+
$ gcloud secrets versions access latest --secret demo-dev-db_pass
|
41
|
+
test2
|
42
|
+
$
|
43
|
+
|
44
|
+
.kubes/output/shared/secret.yaml
|
45
|
+
|
46
|
+
```yaml
|
47
|
+
metadata:
|
48
|
+
namespace: demo
|
49
|
+
name: demo-2a78a13682
|
50
|
+
labels:
|
51
|
+
app: demo
|
52
|
+
apiVersion: v1
|
53
|
+
kind: Secret
|
54
|
+
data:
|
55
|
+
db_pass: dGVzdDEK
|
56
|
+
db_user: dGVzdDIK
|
57
|
+
```
|
58
|
+
|
59
|
+
## Variables
|
60
|
+
|
61
|
+
These environment variables can be set:
|
62
|
+
|
63
|
+
Name | Description
|
64
|
+
---|---
|
65
|
+
GCP_SECRET_PREFIX | Prefixed used to list and filter Google secrets. IE: `projects/686010496118/secrets/demo-dev-`.
|
66
|
+
GOOGLE_PROJECT | Google project id.
|
67
|
+
|
68
|
+
Secrets#initialize options:
|
69
|
+
|
70
|
+
Variable | Description | Default
|
71
|
+
---|---|---
|
72
|
+
base64 | Automatically base64 encode the values. | false
|
73
|
+
upcase | Automatically upcase the Kubernetes secret data keys. | false
|
74
|
+
prefix | Prefixed used to list and filter Google secrets. IE: `projects/686010496118/secrets/demo-dev-`. Can also be set with the `GCP_SECRET_PREFIX` env variable. The env variable takes the highest precedence. | nil
|
75
|
+
|
76
|
+
{% include helpers/base64.md %}
|
@@ -0,0 +1,60 @@
|
|
1
|
+
---
|
2
|
+
title: Google Service Account
|
3
|
+
nav_text: Service Account
|
4
|
+
categories: helpers-google
|
5
|
+
---
|
6
|
+
|
7
|
+
## Service Accounts
|
8
|
+
|
9
|
+
You can automatically create the Google Service Account associated with the [GKE Workload Identity](https://cloud.google.com/kubernetes-engine/docs/how-to/workload-identity).
|
10
|
+
|
11
|
+
Here's a Kubes hook that creates a service account:
|
12
|
+
|
13
|
+
.kubes/config/hooks/kubes.rb
|
14
|
+
|
15
|
+
```ruby
|
16
|
+
service_account = KubesGoogle::ServiceAccount.new(
|
17
|
+
app: "demo",
|
18
|
+
namespace: "demo-#{Kubes.env}", # defaults to APP-ENV when not set. IE: demo-dev
|
19
|
+
roles: ["cloudsql.client", "secretmanager.viewer"], # defaults to empty when not set
|
20
|
+
)
|
21
|
+
before("apply",
|
22
|
+
label: "create service account",
|
23
|
+
execute: service_account,
|
24
|
+
)
|
25
|
+
```
|
26
|
+
|
27
|
+
The corresponding Kubernetes Service account looks like this:
|
28
|
+
|
29
|
+
.kubes/resources/shared/service_account.yaml
|
30
|
+
|
31
|
+
```yaml
|
32
|
+
apiVersion: v1
|
33
|
+
kind: ServiceAccount
|
34
|
+
metadata:
|
35
|
+
annotations:
|
36
|
+
iam.gke.io/gcp-service-account: demo-<%= Kubes.env %>@<%= ENV['GOOGLE_PROJECT'] %>.iam.gserviceaccount.com
|
37
|
+
name: demo
|
38
|
+
labels:
|
39
|
+
app: demo
|
40
|
+
```
|
41
|
+
|
42
|
+
The role permissions are currently always added to the existing permissions. So removing roles that were previously added does not remove them.
|
43
|
+
|
44
|
+
## Variables
|
45
|
+
|
46
|
+
ServiceAccount#initialize options:
|
47
|
+
|
48
|
+
Variable | Description | Default
|
49
|
+
---|---|---
|
50
|
+
app | The app name. It's used to set other variables conventionally. This is required. | nil
|
51
|
+
gsa | The Google Service Account name. The conventional name is APP-ENV. IE: demo-dev. | APP-ENV
|
52
|
+
ksa | The Kubernetes Service Account name. The conventional name is APP. IE: demo | APP
|
53
|
+
namespace | The Kubernetes namespace. Defaults to the APP-ENV. IE: demo-dev. | APP-ENV
|
54
|
+
roles | Google IAM roles to add. This adds permissions to the Google service account. | []
|
55
|
+
|
56
|
+
Relevant environment variables:
|
57
|
+
|
58
|
+
Name | Description
|
59
|
+
---|---
|
60
|
+
GOOGLE_PROJECT | Google project id. This is required as it's used to build the full service account name.
|
data/docs/_docs/intro.md
CHANGED
@@ -11,7 +11,9 @@ title: What is Kubes?
|
|
11
11
|
* Automation: [Builds the Docker image]({% link _docs/config/docker.md %}) and updates the compiled YAML files
|
12
12
|
* Syntactic Sugar: Use an [ERB/YAML]({% link _docs/yaml.md %}) or a [DSL]({% link _docs/dsl.md %}) to write your Kubernetes YAML files. You can use a mix of DSL and YAML definitions in the `.kubes/resources` folder.
|
13
13
|
* Layering: Use the same Kubernetes YAML to build multiple environments like dev and prod with [layering]({% link _docs/layering.md %}).
|
14
|
-
*
|
14
|
+
* Generators: Kubes ships with a few generators to help you get building with Kubernetes quickly. See: [Generator Docs]({% link _docs/generators.md %}).
|
15
|
+
* CLI Customizations: You can customize the [cli args]({% link _docs/config/args/kubectl.md %}).
|
16
|
+
* Hooks: You can also run [hooks]({% link _docs/config/hooks.md %}) before and after [kubes]({% link _docs/config/hooks/kubes.md %}) and [kubectl]({% link _docs/config/hooks/kubectl.md %}) commands.
|
15
17
|
* Automated Suffix Hashes: Automatically appends a suffix hash to ConfigMap and Secret resources. More details in [ConfigMap]({% link _docs/dsl/resources/config_map.md %}) and [Secret]({% link _docs/dsl/resources/secret.md %}) docs.
|
16
18
|
* Kustomize Support: If you’re a kustomization user, you can use it with Kubes. More details in [Kustomize Support Docs]({% link _docs/misc/kustomize.md %}).
|
17
19
|
* Auto Context Switching: Map dev to a specific kubectl context and prod to another kubectl context and Kubes can switch them automatically so you won't have to remember. More details in [Auto Context Docs]({% link _docs/misc/auto-context.md %}).
|
@@ -0,0 +1,66 @@
|
|
1
|
+
---
|
2
|
+
title: Docker Image
|
3
|
+
---
|
4
|
+
|
5
|
+
With Kubes, you can use the `docker_image` helper method to select which image to use. It can use images from these sources:
|
6
|
+
|
7
|
+
1. CLI Option: The `--image` option specified with the CLI command
|
8
|
+
2. Kubes Config: Specified by `config.image` in the `.kubes/config.rb`
|
9
|
+
3. Built Docker Image: The image built from Dockerfile
|
10
|
+
|
11
|
+
The CLI option has the highest precedence, and the Built Docker image has the lowest precedence.
|
12
|
+
|
13
|
+
## 1. CLI Option
|
14
|
+
|
15
|
+
Kubes uses the image from the `--image` option if specified. It's a quick way to override the Docker image used by Kubes. Example:
|
16
|
+
|
17
|
+
kubes deploy --image repo/image:tag
|
18
|
+
|
19
|
+
When the `--image` option is set, Kubes skips the Docker build phase.
|
20
|
+
|
21
|
+
## 2. Kubes Config
|
22
|
+
|
23
|
+
If you set the `config.image` in the Kubes config, Kubes will use this prebuilt Docker image instead. Example:
|
24
|
+
|
25
|
+
.kubes/config.rb:
|
26
|
+
|
27
|
+
```ruby
|
28
|
+
Kubes.configure do |config|
|
29
|
+
config.image = "nginx"
|
30
|
+
end
|
31
|
+
```
|
32
|
+
|
33
|
+
When `config.image` is set, Kubes skips the Docker build phase.
|
34
|
+
|
35
|
+
## 3. Built Docker Image
|
36
|
+
|
37
|
+
Kubes can use a Docker image built from your Dockerfile. This is the default behavior of Kubes, as long as the CLI Option and the Kubes Config option is not set.
|
38
|
+
|
39
|
+
## Template Example
|
40
|
+
|
41
|
+
Here's an example usage of the `docker_image` helper.
|
42
|
+
|
43
|
+
.kubes/resources/web/deployment.yaml
|
44
|
+
|
45
|
+
```yaml
|
46
|
+
apiVersion: apps/v1
|
47
|
+
kind: Deployment
|
48
|
+
metadata:
|
49
|
+
name: web
|
50
|
+
labels:
|
51
|
+
role: web
|
52
|
+
spec:
|
53
|
+
selector:
|
54
|
+
matchLabels:
|
55
|
+
role: web
|
56
|
+
template:
|
57
|
+
metadata:
|
58
|
+
labels:
|
59
|
+
role: web
|
60
|
+
spec:
|
61
|
+
containers:
|
62
|
+
- name: web
|
63
|
+
image: <%= docker_image %>
|
64
|
+
```
|
65
|
+
|
66
|
+
When running `kubes deploy`, Kubes will replace `<%= docker_image %>` with the Docker image from one of the sources described above.
|
@@ -10,20 +10,16 @@ In fact, you can use Kubes to build the files first, and then run `kubectl` dire
|
|
10
10
|
kubes docker push
|
11
11
|
kubes compile # compiles the .kubes/resources files to .kubes/output
|
12
12
|
|
13
|
-
Now, use `kubectl` directly
|
13
|
+
Now, use `kubectl` directly and apply them in the proper order:
|
14
14
|
|
15
|
-
kubectl apply
|
16
|
-
|
17
|
-
You can also selectively apply specific files:
|
18
|
-
|
19
|
-
kubectl apply -f .kubes/output/web/deployment.yaml
|
15
|
+
kubectl apply -f .kubes/output/shared/namespace.yaml
|
20
16
|
kubectl apply -f .kubes/output/web/service.yaml
|
17
|
+
kubectl apply -f .kubes/output/web/deployment.yaml
|
21
18
|
|
22
|
-
|
23
|
-
|
24
|
-
kubes apply
|
25
|
-
|
26
|
-
The deploy command, does all 3 steps: builds the docker image, compiles the `.kubes/resources` files, and runs kubectl apply.
|
19
|
+
The deploy command simpifily does all 3 steps: build, compile, and apply.
|
27
20
|
|
28
21
|
kubes deploy
|
29
22
|
|
23
|
+
You can also run the `kubectl apply` only. The `kube apply` command compiles but will skip the docker build stage if it's already been built.
|
24
|
+
|
25
|
+
kubes apply
|
@@ -67,7 +67,7 @@ The merging of simple String is a straightforward replacement.
|
|
67
67
|
.kubes/resources/web/deployment.rb
|
68
68
|
|
69
69
|
```ruby
|
70
|
-
image
|
70
|
+
image docker_image # IE: user/demo:kubes-2020-06-13T19-55-16-43afc6e
|
71
71
|
# ...
|
72
72
|
```
|
73
73
|
|
@@ -6,11 +6,19 @@ Let's now delete the app and clean up:
|
|
6
6
|
|
7
7
|
kubes delete
|
8
8
|
|
9
|
-
You will be prompted to confirm before deletion.
|
9
|
+
You will be prompted to confirm before deletion.
|
10
10
|
|
11
11
|
$ kubes delete
|
12
|
+
Compiled .kubes/resources files to .kubes/output
|
13
|
+
Will run:
|
14
|
+
kubectl delete -f .kubes/output/web/deployment.yaml
|
15
|
+
kubectl delete -f .kubes/output/web/service.yaml
|
16
|
+
kubectl delete -f .kubes/output/shared/namespace.yaml
|
17
|
+
This will delete resources. Are you sure? (y/N)
|
18
|
+
|
19
|
+
Confirm to delete the resources:
|
20
|
+
|
12
21
|
This will delete resources. Are you sure? (y/N) y
|
13
|
-
Compiled .kubes/resources files
|
14
22
|
=> kubectl delete -f .kubes/output/web/service.yaml
|
15
23
|
service "demo-web" deleted
|
16
24
|
=> kubectl delete -f .kubes/output/web/deployment.yaml
|
@@ -29,10 +29,10 @@ labels(role: "web")
|
|
29
29
|
namespace "default"
|
30
30
|
|
31
31
|
replicas 1
|
32
|
-
image
|
32
|
+
image docker_image # IE: user/demo:kubes-2020-06-13T19-55-16-43afc6e
|
33
33
|
```
|
34
34
|
|
35
|
-
The DSL form is more concise than the YAML form. Also, notice the use of the `
|
35
|
+
The DSL form is more concise than the YAML form. Also, notice the use of the `docker_image` helper. The `docker_image` is a kubes helper method that refers to the latest Docker image built. This spares you from updating the image manually.
|
36
36
|
|
37
37
|
## Base Folder
|
38
38
|
|
@@ -6,11 +6,19 @@ Let's now delete the app and clean up:
|
|
6
6
|
|
7
7
|
kubes delete
|
8
8
|
|
9
|
-
You will be prompted to confirm before deletion.
|
9
|
+
You will be prompted to confirm before deletion.
|
10
10
|
|
11
11
|
$ kubes delete
|
12
|
+
Compiled .kubes/resources files to .kubes/output
|
13
|
+
Will run:
|
14
|
+
kubectl delete -f .kubes/output/web/deployment.yaml
|
15
|
+
kubectl delete -f .kubes/output/web/service.yaml
|
16
|
+
kubectl delete -f .kubes/output/shared/namespace.yaml
|
17
|
+
This will delete resources. Are you sure? (y/N)
|
18
|
+
|
19
|
+
Confirm to delete the resources:
|
20
|
+
|
12
21
|
This will delete resources. Are you sure? (y/N) y
|
13
|
-
Compiled .kubes/resources files
|
14
22
|
=> kubectl delete -f .kubes/output/web/service.yaml
|
15
23
|
service "demo-web" deleted
|
16
24
|
=> kubectl delete -f .kubes/output/web/deployment.yaml
|