Other cool apps for Kubernetes¶
Here is a list of some more apps that a cool to have.
KubePug / Deprecations¶
KubePug/Deprecations is intended to be a kubectl plugin, which:
- Downloads a swagger.json from a specific Kubernetes version
- Parses this Json finding deprecation notices
- Verifies the current kubernetes cluster or input files checking whether exists objects in this deprecated API Versions, allowing the user to check before migrating
This is a tool that you can use locally or in your CI to ensure you're not working with deprecated resources.
install¶
Usage¶
-
Full cluster scan
This will walk you through all your k8s resources (in the local context) and compare them to the target version (here 1.25). You will get warnings if you still have resources using deprecated APIs :
-
File scan
This command will look at the resources inside the
../yaml/sample_app.yaml
and compare it to the Kubernetes API versionv1.25.0
. It will report every resource that is outdated:
Dive¶
Dive is an utility to inspect Docker Images. While it is not directly used with Kubernetes, it can help improve size and security in the pod's images.
Install¶
Note
If using podman
or any Docker-For-desktop replacement, you need to ensure Dive
will be able to connect to the Docker Daemon. Set DOCKER_HOST
variable accordinately:
Usage¶
-
check Alpine image
Dasel¶
Use Dasel to query and modify data structures using selector strings.
It is Comparable to jq / yq, but supports JSON, YAML, TOML, XML and CSV with zero runtime dependencies.
This is the swiss army knife of the structrued file (in the command line).
Install¶
Usage¶
Here's some sample usage, taken from the doc:
# Pretty Print JSON
echo '[{"name": "Tom"},{"name": "Paul"}]' | dasel -p json
[
{
"name": "Tom"
},
{
"name": "Paul"
}
]
# JSON to YAML
echo '[{"name": "Tom"},{"name": "Paul"}]' | dasel -r json -w yaml
- name: Tom
- name: Paul
While this is some good example, here's some real-case usage with K8s.
Let's create a sample deployment file:
Warning
It is important to keep the .yaml
extension of the file as Dasel
use it to auto-find the right language. If not, you can force it using the -p
or --parser
flag, or the individual --read
and --write
.
-
Select the image of the
manager
container -
Change the image of the
manager
containe in-place -
Update replicas to 3 in-place
-
Add a new env var to the deployment
-
Update an existing env var
Warning
The above commands are not fail-proof, and executing dasel put
multiple times may generate invalid yaml.
Next¶
This is the end of the tutorial. If you want, use the Cleanup script to remove most of what you installed.