Skip to main content

A CLI tool for managing installations and Kubernetes operations

This project has been archived.

The maintainers of this project have marked this project as archived. No new releases are expected.

Project description

k4s

A CLI tool for managing installations and Kubernetes operations.

It helps install and operate:

  • VM-based products over SSH (systemd services, OS packages, file layout)
  • Kubernetes-based products via Helm (with safer targeting via k8s contexts)

Installation

Recommended (isolated install):

pipx install k4s

Alternative:

pip install --upgrade k4s

Quick start

Initialize local state:

k4s init

Add a VM context (SSH target) and set it as current:

k4s context add prod-vm --type vm --host 10.0.0.10 --username root --password '...'
k4s context use-context prod-vm
k4s context ping

Add a K8s context and set it as current:

k4s context add demo-k8s --type k8s --kubeconfig ~/.kube/config --kubectl-context gke_demo --namespace sep
k4s context use-context demo-k8s
k4s context ping

Core concepts

Contexts (targets)

k4s always operates against a context:

  • VM contexts: SSH connection info (host, username, auth)
  • K8s contexts: kubeconfig + kubectl context + (optional) default namespace

If --context is omitted, k4s uses the current context (set via k4s context use-context).

Verbosity

  • -q/--quiet: only final results and errors (also suppresses update notices)
  • default: concise step output
  • -v: show step logs
  • -vv: debug output

Dry run

Most commands support --dry-run to print the plan without applying changes.

Products and commands

VM products (SSH)

  • Docker Engine: k4s install docker
  • Nexus: k4s install nexus
  • Dataiku: k4s install dataiku
  • R integration (for an existing Dataiku install): k4s install r

Health checks (works even if the product was not installed by k4s):

k4s status nexus
k4s status dataiku --context prod-vm

TLS:

k4s tls enable nexus --issuer self-signed --domain nexus.example.com
k4s tls enable dataiku --issuer acme --domain dss.example.com --email admin@example.com

Kubernetes products (Helm)

  • ingress-nginx: k4s install ingress-nginx
  • Starburst Enterprise: k4s install starburst
  • Starburst components: k4s install hive|ranger|cache
  • Datafloem: k4s install datafloem

Upgrades:

k4s upgrade starburst --force
k4s upgrade datafloem

Example Helm values files:

  • See examples/helm-values/

Kubernetes clusters (RKE2)

Create an RKE2 cluster using VM node contexts:

k4s cluster preflight --control-plane cp1 --worker w1
k4s cluster create --name lab --type rke2 --control-plane cp1 --worker w1 --cni canal
k4s cluster kubeconfig --name lab --control-plane cp1

Updates

When installed from PyPI, k4s checks once per day for a newer version and prints a notice:

Update available: 0.0.1a1 → 0.0.2  (run: pip install --upgrade k4s)

Development

python3 -m venv .venv
source .venv/bin/activate
pip install -r requirements.txt
pip install -e .
pytest

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

k4s-0.0.1b2.tar.gz (121.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

k4s-0.0.1b2-py3-none-any.whl (157.3 kB view details)

Uploaded Python 3

File details

Details for the file k4s-0.0.1b2.tar.gz.

File metadata

  • Download URL: k4s-0.0.1b2.tar.gz
  • Upload date:
  • Size: 121.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.0

File hashes

Hashes for k4s-0.0.1b2.tar.gz
Algorithm Hash digest
SHA256 0a09c4d9247e8fda7330902153139b8a3d0600dffacce6b215e18b6f58f4556b
MD5 7735db301d0efca7c718d7e5c6623ed2
BLAKE2b-256 ab391f98eefa115d683a58fd7266bd0b7a1a48418f17e2ddf6c0cad909b6f5f8

See more details on using hashes here.

File details

Details for the file k4s-0.0.1b2-py3-none-any.whl.

File metadata

  • Download URL: k4s-0.0.1b2-py3-none-any.whl
  • Upload date:
  • Size: 157.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.0

File hashes

Hashes for k4s-0.0.1b2-py3-none-any.whl
Algorithm Hash digest
SHA256 4ce7fc4fb2551d8f32d336c4484c4a8579105db8305787f5805428ffdabd65b7
MD5 a6961add9a9dd209f99906254278b8fe
BLAKE2b-256 91606274e274dec4c0e2b2f7c0fd4c5a0f2817ed6442e9e0640a077b2f85d71d

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page