NOTE: This repo contains only the documentation for the private BoltsOps repo code. Original file: https://github.com/boltops-pro/kubes-pro/blob/main/README.md The docs are publish so they are available for interested subscribers. For access to the source code, you can become a BoltOps subscriber. See: https://learn.boltops.com
Kubernetes Deploy Tool: build docker image, compile Kubernetes YAML files, and apply them.
Kubes is a mixture of Helm and Kustomize concepts. It tries to use the best of each world and adds additional conveniences on top.
Please watch/star this repo to help grow and support the project.
Official Docs Site: kubes.guru
Kubes will:
- Build the docker image and push it to repo
- Build Kubernetes YAML files from YAML/ERB or a DSL referencing the Docker image
- Deploy via
kubectl apply
on the compiled Kubernetes YAML files
kubes init # creates .kubes structure
# edit the .kubes/resources files to your needs
kubes deploy
Kubes is pretty straightforward. Kubes first builds the Docker image and compiles Kubernetes YAML files. Then it merely calls kubectl
.
In fact, you can use Kubes to build the files first, and then run kubectl
directly. Example:
kubes docker build
kubes docker push
kubes build # builds or compiles the .kubes/resources files to .kubes/output
Now, use kubectl
directly in the proper order:
kubectl apply -f .kubes/output/shared/namespace.yaml
kubectl apply -f .kubes/output/web/service.yaml
kubectl apply -f .kubes/output/web/deployment.yaml
You can also apply with kubes. This will automatically compile the files also.
kubes apply
The deploy command, does all 3 steps: builds the docker image, compiles the .kubes/resources
files, and runs kubectl apply.
kubes deploy
You can easily create multiple environments with the same YAML configs. Example:
KUBES_ENV=dev kubes deploy
KUBES_ENV=prod kubes deploy
See: Multiple Enviroments Pattern
Your time is precious. Why are we copying and pasting boilerplate structure in this day and age?
Kubes provides generators to help you get going right away.
Resources examples:
$ kubes new resource secret
create .kubes/resources/shared/secret.yaml
$ kubes new resource service_account
create .kubes/resources/shared/service_account.yaml
Kubes components examples:
$ kubes new helper
create .kubes/helpers/custom_helper.rb
$ kubes new variable
create .kubes/variables/dev.rb
$
- Automation: Builds the Docker image and updates the compiled YAML files
- Release History: Keeps track of Release History.
- Rollback: Ability to Rollback a deploy.
- Build and Apply Directly: You can use kubes to build YAML resource manifests and pipe them to kubectl apply directly.
- Job Support: Kubes makes running Kubernetes jobs easier.
- Layering: Use the same Kubernetes YAML to build multiple environments like dev and prod with layering.
- Secrets: Use helpers like aws_secret, aws_ssm, and google_secret to build Kubernetes secrets.yaml from secret providers designed for it.
- Generators: Kubes ships with a few generators to help you get building with Kubernetes quickly. See: Generator Docs.
- CLI Customizations: You can customize the cli args.
- Hooks: You can also run hooks before and after kubes and kubectl commands.
- Automated Suffix Hashes: Automatically appends a suffix hash to ConfigMap and Secret resources. More details in ConfigMap and Secret docs.
- Kustomize Support: If you're a kustomization user, you can use it with Kubes. More details in Kustomize Support Docs.
- 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.
- Ordering: Kubes run kubectl apply to create resources in the correct order. For deleting, it kubes will run
kubectl delete
in the correct reverse order. The order is also customizable. - Syntactic Sugar: Use an ERB/YAML or a DSL to write your Kubernetes YAML files. You can use a mix of DSL and YAML definitions in the
.kubes/resources
folder.
Install with:
gem install kubes
Here are some useful comparisons to help you compare Kubes vs other tools in the ecosystem:
- Blog Post: Kustomize vs Helm vs Kubes: Kubernetes Deploy Tools
- Kubes vs Custom Solution
- Kubes vs Helm
- Kubes vs Kustomize
For more info: kubes.guru