Lightweight Python module for creating, manipulating, and editing kubeconfig files
Project description
kubeconf
Lightweight Python module for creating, manipulating, and editing kubeconfig files
Why not use or wrap kubectl config
?
kubectl config
is great and writing a Python wrapper is a fine solution. However, kubectl config
is quite limited in functionality. I wanted more control over my kubernetes config. kubeconfig gives me that control. It doesn't use kubectl at all. Rather, it reads, edits, and writes config files entirely on its own.
Getting starting
Install this package using pip:
pip install kubeconf
Basic Usage
from kubeconf import KubeConf
k = KubeConf(path='path/to/config')
# Open the file
k.open()
# Add a cluster
k.add_cluster(
name='mycluster',
server='...',
certificate_authority_data='...',
)
# Add a user for that cluster
k.add_user(
user='me'
)
# Add a context to map the user to the cluster
k.add_context(
name='mycontext',
cluster_name='mycluster',
user_name='me'
)
# Commit change to the file.
k.close()
Developing
Download and install this repo from source, and move into the base directory.
git clone https://github.com/Zsailer/kubeconf
cd kubeconf
If you use pipenv, you can install a developement version:
pipenv install --dev
Otherwise you can install a development version using pip
pip install -e .
Licensing
The code in this project is licensed under MIT license.
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
Built Distribution
Hashes for kubeconf-0.0.1-py2.py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 03b5b656188794426b85caecc3f17b8b0cc1406c581b024b72333bf502a10f5f |
|
MD5 | 107394c2ff2098e030921687449eaca0 |
|
BLAKE2b-256 | a31504e52083e465d7ffdabd3d874baf2918eabca0de6f73160bbb12aa0b3c7e |