kubes 0.2.4 → 0.3.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +17 -0
- data/docs/_docs/auto-context.md +4 -4
- data/docs/_docs/config/builder.md +46 -0
- data/docs/_docs/config/env.md +3 -3
- data/docs/_docs/dsl/resources/service.md +21 -5
- data/docs/_docs/learn/dsl/deploy.md +2 -0
- data/docs/_docs/learn/dsl/new-project.md +1 -2
- data/docs/_docs/learn/yaml/deploy.md +2 -0
- data/docs/_docs/learn/yaml/new-project.md +1 -2
- data/docs/_includes/intro/install.md +5 -1
- data/docs/_includes/learn/cluster.md +21 -4
- data/docs/_includes/learn/repo +0 -0
- data/docs/_includes/learn/repos.md +10 -0
- data/docs/_includes/learn/review.md +2 -2
- data/docs/_includes/sidebar.html +1 -0
- data/docs/_reference/kubes-apply.md +2 -2
- data/docs/_reference/kubes-delete.md +1 -1
- data/docs/_reference/kubes-deploy.md +1 -1
- data/docs/_reference/kubes-describe.md +24 -0
- data/docs/_reference/kubes-exec.md +42 -0
- data/docs/_reference/kubes-get.md +27 -0
- data/docs/_reference/kubes-init.md +1 -1
- data/docs/_reference/kubes-logs.md +26 -0
- data/docs/_sass/theme.scss +2 -1
- data/docs/bin/web +1 -1
- data/docs/img/logos/kubes-white.png +0 -0
- data/docs/index.html +2 -2
- data/docs/reference.md +4 -0
- data/lib/kubes/cli.rb +22 -0
- data/lib/kubes/cli/apply.rb +1 -1
- data/lib/kubes/cli/base.rb +4 -0
- data/lib/kubes/cli/build.rb +2 -2
- data/lib/kubes/cli/delete.rb +7 -2
- data/lib/kubes/cli/describe.rb +1 -1
- data/lib/kubes/cli/docker.rb +2 -2
- data/lib/kubes/cli/exec.rb +34 -0
- data/lib/kubes/cli/get.rb +3 -1
- data/lib/kubes/cli/help/exec.md +24 -0
- data/lib/kubes/cli/logs.rb +15 -0
- data/lib/kubes/compiler/dsl/syntax/deployment.rb +85 -2
- data/lib/kubes/compiler/dsl/syntax/service.rb +11 -0
- data/lib/kubes/config.rb +2 -0
- data/lib/kubes/docker.rb +19 -0
- data/lib/kubes/docker/strategy/build/base.rb +24 -0
- data/lib/kubes/docker/strategy/build/docker.rb +11 -0
- data/lib/kubes/docker/strategy/build/gcloud.rb +10 -0
- data/lib/kubes/docker/strategy/hooks.rb +9 -0
- data/lib/kubes/docker/{base.rb → strategy/image_name.rb} +19 -32
- data/lib/kubes/docker/strategy/push/base.rb +9 -0
- data/lib/kubes/docker/{push.rb → strategy/push/docker.rb} +2 -5
- data/lib/kubes/docker/strategy/push/gcloud.rb +9 -0
- data/lib/kubes/docker/strategy/utils.rb +9 -0
- data/lib/kubes/hooks/builder.rb +2 -1
- data/lib/kubes/kubectl.rb +15 -3
- data/lib/kubes/kubectl/batch.rb +8 -1
- data/lib/kubes/kubectl/fetch/base.rb +24 -0
- data/lib/kubes/kubectl/fetch/deployment.rb +34 -0
- data/lib/kubes/kubectl/fetch/pods.rb +21 -0
- data/lib/kubes/util/sh.rb +1 -0
- data/lib/kubes/version.rb +1 -1
- data/lib/templates/dsl/.kubes/resources/web/deployment.rb +2 -1
- data/lib/templates/dsl/.kubes/resources/web/service.rb +1 -1
- metadata +26 -5
- data/lib/kubes/docker/build.rb +0 -22
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 717e82d009d9109cbd891aa3881a0ab645fca4388a0268b979bd80b6c65b4b5a
|
4
|
+
data.tar.gz: bf0fa4160bcc4592e8ec04e4aa408f36797c0486fe2265ee9aee2406b152502a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 459680ca83a280070c044ada5ff57a12c960e92d6c5d4a4c27f1fed9aca27047e6eb31fef3d24697be9f5f30cb745fac450062d7e0d5cdafbb37997c41f7b91f
|
7
|
+
data.tar.gz: 8530622fe5dd61e41c20213b11b296964c14dd5ef7a7510a5df5e6bbe51d4dc3be6dae763bac4faa3784fea1530f4680d2fb24806ed8fc08e283595b315be553
|
data/CHANGELOG.md
CHANGED
@@ -3,6 +3,23 @@
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
4
4
|
This project *loosely tries* to adhere to [Semantic Versioning](http://semver.org/), even before v1.0.
|
5
5
|
|
6
|
+
## [0.3.2]
|
7
|
+
- #21 add namespace to logs command
|
8
|
+
|
9
|
+
## [0.3.1]
|
10
|
+
- #20 improve sidecar support. kubes exec -c option also
|
11
|
+
|
12
|
+
## [0.3.0]
|
13
|
+
- #19 new commands: exec, logs
|
14
|
+
- delete preview
|
15
|
+
- show pods as part of get
|
16
|
+
|
17
|
+
## [0.2.6]
|
18
|
+
- #18 gcloud builder. change to config.builder
|
19
|
+
|
20
|
+
## [0.2.5]
|
21
|
+
- #17 cloudbuild build strategy
|
22
|
+
|
6
23
|
## [0.2.4]
|
7
24
|
- #16 google cloudbuild support & docs: add Dockerfile for kubes as a docker entrypoint
|
8
25
|
|
data/docs/_docs/auto-context.md
CHANGED
@@ -22,7 +22,7 @@ You can override configs on a per-env basis with `config/env` files. Examples:
|
|
22
22
|
```ruby
|
23
23
|
Kubes.configure do |config|
|
24
24
|
config.repo = "222222222222.dkr.ecr.us-west-2.amazonaws.com/demo"
|
25
|
-
config.kubectl.context = "dev-
|
25
|
+
config.kubectl.context = "dev-cluster"
|
26
26
|
end
|
27
27
|
```
|
28
28
|
|
@@ -31,7 +31,7 @@ end
|
|
31
31
|
```ruby
|
32
32
|
Kubes.configure do |config|
|
33
33
|
config.repo = "333333333333.dkr.ecr.us-west-2.amazonaws.com/demo"
|
34
|
-
config.kubectl.context = "prod-
|
34
|
+
config.kubectl.context = "prod-cluster"
|
35
35
|
end
|
36
36
|
```
|
37
37
|
|
@@ -39,8 +39,8 @@ end
|
|
39
39
|
|
40
40
|
With this setup, when you deploy with kubes, it will automatically switch the kubectl context based on `KUBES_ENV`. Example:
|
41
41
|
|
42
|
-
KUBES_ENV=dev kubes deploy # to dev-
|
43
|
-
KUBES_ENV=prod kubes deploy # to prod-
|
42
|
+
KUBES_ENV=dev kubes deploy # to dev-cluster context
|
43
|
+
KUBES_ENV=prod kubes deploy # to prod-cluster context
|
44
44
|
|
45
45
|
## context_keep Option
|
46
46
|
|
@@ -0,0 +1,46 @@
|
|
1
|
+
---
|
2
|
+
title: Builder Strategy
|
3
|
+
---
|
4
|
+
|
5
|
+
Kubes uses the `docker` command to build the docker image by default. Kubes can also support an additional builder: gcloud.
|
6
|
+
|
7
|
+
## Gcloud Builder
|
8
|
+
|
9
|
+
With the gcloud builder, you do not need docker installed locally. Google CloudBuild is used to build and push the image to a GCR registry.
|
10
|
+
|
11
|
+
You must set up the [gcloud cli](https://cloud.google.com/sdk/gcloud/reference/builds/submit). Please refer to the [gcloud sdk install docs](https://cloud.google.com/sdk/install). Kubes will call out to `gcloud builds submit` to create the Docker image.
|
12
|
+
|
13
|
+
## Configure
|
14
|
+
|
15
|
+
You configure gcloud as the builder like so:
|
16
|
+
|
17
|
+
```ruby
|
18
|
+
Kubes.configure do |config|
|
19
|
+
config.repo = "gcr.io/#{ENV['GOOGLE_PROJECT']}/demo"
|
20
|
+
config.logger.level = "info"
|
21
|
+
config.builder = "gcloud" # <= changed to gcloud
|
22
|
+
end
|
23
|
+
```
|
24
|
+
|
25
|
+
## Commands
|
26
|
+
|
27
|
+
The kubes builds command will remain the same.
|
28
|
+
|
29
|
+
kubes docker build
|
30
|
+
|
31
|
+
There is no need to run the push command, as the build command with the gcloud builder will always push.
|
32
|
+
|
33
|
+
## Deploy
|
34
|
+
|
35
|
+
The deploy commands remain the same. Example:
|
36
|
+
|
37
|
+
kubes deploy web
|
38
|
+
|
39
|
+
If you want to skip the `docker build` phase of the deploy, you can run:
|
40
|
+
|
41
|
+
kubes deploy web --no-build
|
42
|
+
|
43
|
+
Also, kubes apply another way to skip the docker build:
|
44
|
+
|
45
|
+
kubes apply web
|
46
|
+
|
data/docs/_docs/config/env.md
CHANGED
@@ -11,7 +11,7 @@ Kubes.configure do |config|
|
|
11
11
|
config.repo = "111111111111.dkr.ecr.us-west-2.amazonaws.com/demo"
|
12
12
|
config.logger.level = "info"
|
13
13
|
# auto-switching
|
14
|
-
# config.kubectl.context = "dev-
|
14
|
+
# config.kubectl.context = "dev-cluster"
|
15
15
|
# config.kubectl.context_keep = false
|
16
16
|
end
|
17
17
|
```
|
@@ -25,7 +25,7 @@ You can override configs on a per-env basis with `config/env` files. Examples:
|
|
25
25
|
```ruby
|
26
26
|
Kubes.configure do |config|
|
27
27
|
config.repo = "222222222222.dkr.ecr.us-west-2.amazonaws.com/demo"
|
28
|
-
config.kubectl.context = "dev-
|
28
|
+
config.kubectl.context = "dev-cluster"
|
29
29
|
end
|
30
30
|
```
|
31
31
|
|
@@ -34,7 +34,7 @@ end
|
|
34
34
|
```ruby
|
35
35
|
Kubes.configure do |config|
|
36
36
|
config.repo = "333333333333.dkr.ecr.us-west-2.amazonaws.com/demo"
|
37
|
-
config.kubectl.context = "prod-
|
37
|
+
config.kubectl.context = "prod-cluster"
|
38
38
|
end
|
39
39
|
```
|
40
40
|
|
@@ -46,15 +46,31 @@ spec:
|
|
46
46
|
|
47
47
|
## DSL Methods
|
48
48
|
|
49
|
-
Here's a list of
|
49
|
+
Here's a list of some of the methods:
|
50
|
+
|
51
|
+
kubectl explain service.spec
|
52
|
+
|
53
|
+
* clusterIP
|
54
|
+
* externalIPs
|
55
|
+
* externalName
|
56
|
+
* externalTrafficPolicy
|
57
|
+
* healthCheckNodePort
|
58
|
+
* ipFamily
|
59
|
+
* loadBalancerIP
|
60
|
+
* loadBalancerSourceRanges
|
61
|
+
* ports
|
62
|
+
* publishNotReadyAddresses
|
63
|
+
* selector
|
64
|
+
* sessionAffinity
|
65
|
+
* sessionAffinityConfig
|
66
|
+
* type
|
67
|
+
|
68
|
+
kubectl explain service.spec.ports
|
50
69
|
|
51
70
|
* nodePort
|
52
71
|
* port
|
53
|
-
* portName: Note this field doesn't match the original field name. It's more qualified.
|
54
|
-
* ports
|
72
|
+
* portName: : Note this field doesn't match the original field name. It's more qualified.
|
55
73
|
* protocol
|
56
|
-
* selector
|
57
74
|
* targetPort
|
58
|
-
* type
|
59
75
|
|
60
76
|
{% include dsl/methods.md name="service" %}
|
@@ -7,11 +7,10 @@ If you already a project with an existing Dockerfile, you can use that. If you d
|
|
7
7
|
mkdir demo
|
8
8
|
cd demo
|
9
9
|
|
10
|
-
|
10
|
+
{% include learn/repos.md %}
|
11
11
|
|
12
12
|
Let's generate a starter project:
|
13
13
|
|
14
|
-
$ REPO=$(aws ecr describe-repositories --repository-name demo | jq -r '.repositories[].repositoryUri')
|
15
14
|
$ kubes init --app demo --repo $REPO --type dsl
|
16
15
|
create .kubes/config.rb
|
17
16
|
create .kubes/config/env/dev.rb
|
@@ -7,11 +7,10 @@ If you already a project with an existing Dockerfile, you can use that. If you d
|
|
7
7
|
mkdir demo
|
8
8
|
cd demo
|
9
9
|
|
10
|
-
|
10
|
+
{% include learn/repos.md %}
|
11
11
|
|
12
12
|
Let's generate a starter project:
|
13
13
|
|
14
|
-
$ REPO=$(aws ecr describe-repositories --repository-name demo | jq -r '.repositories[].repositoryUri')
|
15
14
|
$ kubes init --app demo --repo $REPO
|
16
15
|
create Dockerfile
|
17
16
|
create .kubes/config.rb
|
@@ -4,7 +4,7 @@ Install kubes via RubyGems.
|
|
4
4
|
|
5
5
|
gem install kubes
|
6
6
|
|
7
|
-
Ruby 2.7 and
|
7
|
+
Ruby 2.7 and above is recommended.
|
8
8
|
|
9
9
|
## kubectl
|
10
10
|
|
@@ -13,3 +13,7 @@ Kubes calls kubectl. Kubes has been tested with kubectl v1.15+. Generally, it sh
|
|
13
13
|
## docker
|
14
14
|
|
15
15
|
Kubes calls docker. Kubes has been tested with docker 18.x-ce+. Generally, it should work with most versions of docker.
|
16
|
+
|
17
|
+
## gcloud
|
18
|
+
|
19
|
+
If you are using the [gcloud builder](% link _docs/config/builder.md %), set up and configure the [gcloud cli](https://cloud.google.com/sdk/install).
|
@@ -1,12 +1,12 @@
|
|
1
|
-
You'll need a Kubernetes cluster and a Docker repo to be able to push to. Setting up a Kubernetes cluster is a little bit out scope for this tutorial. We'll provide the docs and links though. We'll
|
1
|
+
You'll need a Kubernetes cluster and a Docker repo to be able to push to. Setting up a Kubernetes cluster is a little bit out scope for this tutorial. We'll provide the docs and links though. We'll provide instructions for AWS and Google.
|
2
2
|
|
3
|
-
## Create an EKS cluster
|
3
|
+
## AWS: Create an EKS cluster
|
4
4
|
|
5
5
|
Here are the AWS docs to create an EKS cluster:
|
6
6
|
|
7
7
|
* [Creating an Amazon EKS cluster](https://docs.aws.amazon.com/eks/latest/userguide/create-cluster.html)
|
8
8
|
|
9
|
-
## Create an ECR Repo
|
9
|
+
## AWS: Create an ECR Repo
|
10
10
|
|
11
11
|
Here are the AWS docs to create a repo:
|
12
12
|
|
@@ -19,4 +19,21 @@ Here are also the commands to create an ECR repo:
|
|
19
19
|
|
20
20
|
We'll be using the `$REPO` variable for the rest of the tutorial.
|
21
21
|
|
22
|
-
|
22
|
+
## Google: Create GKE Cluster
|
23
|
+
|
24
|
+
Here are the Google docs to create an GKE cluster:
|
25
|
+
|
26
|
+
* [Creating an Google GKE cluster](https://cloud.google.com/kubernetes-engine/docs/how-to/creating-a-regional-cluster)
|
27
|
+
|
28
|
+
## Google: GCR Repo
|
29
|
+
|
30
|
+
For google, you do not have to create a repo. You simply push to the right repo url. Example:
|
31
|
+
|
32
|
+
export GOOGLE_PROJECT=project-123
|
33
|
+
REPO=gcr.io/$GOOGLE_PROJECT/demo
|
34
|
+
|
35
|
+
## Repo Variable
|
36
|
+
|
37
|
+
We'll be using the `$REPO` variable for the rest of the tutorial.
|
38
|
+
|
39
|
+
Note: Though we're using AWS and Google here, Kubes works with any Cloud Provider. Please adjust your commands and the `$REPO` variable for your cloud provider.
|
File without changes
|
@@ -0,0 +1,10 @@
|
|
1
|
+
For this tutorial, here are examples of AWS ECR and Google GCR repos, though any repo will work.
|
2
|
+
|
3
|
+
AWS:
|
4
|
+
|
5
|
+
REPO=$(aws ecr describe-repositories --repository-name demo | jq -r '.repositories[].repositoryUri')
|
6
|
+
|
7
|
+
Google:
|
8
|
+
|
9
|
+
export GOOGLE_PROJECT=project-123
|
10
|
+
REPO=gcr.io/$GOOGLE_PROJECT/demo
|
@@ -4,10 +4,10 @@ The `config.rb` is where you can configure Kubes settings.
|
|
4
4
|
|
5
5
|
```ruby
|
6
6
|
Kubes.configure do |config|
|
7
|
-
config.repo = "112233445566.dkr.ecr.us-west-2.amazonaws.com/demo"
|
7
|
+
config.repo = "112233445566.dkr.ecr.us-west-2.amazonaws.com/demo" # may be gcr.io/project-123/demo
|
8
8
|
config.logger.level = "info"
|
9
9
|
# auto-switching
|
10
|
-
# config.kubectl.context = "dev-
|
10
|
+
# config.kubectl.context = "dev-cluster"
|
11
11
|
end
|
12
12
|
```
|
13
13
|
|
data/docs/_includes/sidebar.html
CHANGED
@@ -56,6 +56,7 @@
|
|
56
56
|
<li><a href="{% link _docs/config/docker.md %}">Docker</a></li>
|
57
57
|
<li><a href="{% link _docs/config/env.md %}">Env</a></li>
|
58
58
|
<li><a href="{% link _docs/config/kubectl.md %}">Kubectl</a></li>
|
59
|
+
<li><a href="{% link _docs/config/builder.md %}">Builder</a></li>
|
59
60
|
</ul>
|
60
61
|
</li>
|
61
62
|
<li><a href="{% link _docs/yaml.md %}">YAML</a></li>
|
@@ -5,11 +5,11 @@ reference: true
|
|
5
5
|
|
6
6
|
## Usage
|
7
7
|
|
8
|
-
kubes apply [
|
8
|
+
kubes apply [ROLE] [RESOURCE]
|
9
9
|
|
10
10
|
## Description
|
11
11
|
|
12
|
-
Apply the Kubernetes YAML files without
|
12
|
+
Apply the Kubernetes YAML files without building docker image
|
13
13
|
|
14
14
|
|
15
15
|
## Options
|
@@ -0,0 +1,24 @@
|
|
1
|
+
---
|
2
|
+
title: kubes describe
|
3
|
+
reference: true
|
4
|
+
---
|
5
|
+
|
6
|
+
## Usage
|
7
|
+
|
8
|
+
kubes describe [ROLE] [RESOURCE]
|
9
|
+
|
10
|
+
## Description
|
11
|
+
|
12
|
+
Describe Kubernetes resource using the compiled YAML files
|
13
|
+
|
14
|
+
|
15
|
+
## Options
|
16
|
+
|
17
|
+
```
|
18
|
+
[--image=IMAGE] # override image
|
19
|
+
[--compile], [--no-compile] # whether or not to compile the .kube/resources
|
20
|
+
# Default: true
|
21
|
+
[--verbose], [--no-verbose]
|
22
|
+
[--noop], [--no-noop]
|
23
|
+
```
|
24
|
+
|
@@ -0,0 +1,42 @@
|
|
1
|
+
---
|
2
|
+
title: kubes exec
|
3
|
+
reference: true
|
4
|
+
---
|
5
|
+
|
6
|
+
## Usage
|
7
|
+
|
8
|
+
kubes exec
|
9
|
+
|
10
|
+
## Description
|
11
|
+
|
12
|
+
Exec into the latest container from the deployment
|
13
|
+
|
14
|
+
The exec command finds the latest pod from the deployment and runs `kubectl exec -ti POD bash` to get you into it. It spares you from having to manually find and type it.
|
15
|
+
|
16
|
+
## Examples
|
17
|
+
|
18
|
+
kubes exec
|
19
|
+
kubes exec sh
|
20
|
+
kubes exec ls -l
|
21
|
+
|
22
|
+
## Multiple Deployments
|
23
|
+
|
24
|
+
If you have have multiple deployments in your `.kubes/resources` then the command will use the first deployment by default. You can specify the specfic deployment with the `--name` option. Examples:
|
25
|
+
|
26
|
+
kubes exec --name demo-web
|
27
|
+
kubes exec --name demo-clock
|
28
|
+
kubes exec --name demo-worker
|
29
|
+
kubes exec --name demo-web sh
|
30
|
+
kubes exec --name demo-web ls -l
|
31
|
+
|
32
|
+
|
33
|
+
## Options
|
34
|
+
|
35
|
+
```
|
36
|
+
[--compile], [--no-compile] # whether or not to compile the .kube/resources
|
37
|
+
# Default: true
|
38
|
+
n, [--name=NAME] # deployment name to use. IE: demo-web
|
39
|
+
[--verbose], [--no-verbose]
|
40
|
+
[--noop], [--no-noop]
|
41
|
+
```
|
42
|
+
|
@@ -0,0 +1,27 @@
|
|
1
|
+
---
|
2
|
+
title: kubes get
|
3
|
+
reference: true
|
4
|
+
---
|
5
|
+
|
6
|
+
## Usage
|
7
|
+
|
8
|
+
kubes get [ROLE] [RESOURCE]
|
9
|
+
|
10
|
+
## Description
|
11
|
+
|
12
|
+
Get Kubernetes resource using the compiled YAML files
|
13
|
+
|
14
|
+
|
15
|
+
## Options
|
16
|
+
|
17
|
+
```
|
18
|
+
[--image=IMAGE] # override image
|
19
|
+
[--compile], [--no-compile] # whether or not to compile the .kube/resources
|
20
|
+
# Default: true
|
21
|
+
o, [--output=OUTPUT] # Output format: json|yaml|wide|name
|
22
|
+
[--show-pods], [--no-show-pods] # Also show pods from deployments
|
23
|
+
# Default: true
|
24
|
+
[--verbose], [--no-verbose]
|
25
|
+
[--noop], [--no-noop]
|
26
|
+
```
|
27
|
+
|