No project description provided
Project description
tokeks
A zero-dependency Python library for getting the Kubernetes token of a AWS EKS cluster.
No AWS CLI, third-party client or library (boto3, botocore, etc.) required.
Installation
pip install tokeks
Usage prerequisites
Assign your credentials to environment variables:
export AWS_ACCESS_KEY_ID="..."
export AWS_SECRET_ACCESS_KEY="..."
Library usage
from tokeks import Tokeks
tokeks = Tokeks(
access_key_id=os.environ['AWS_ACCESS_KEY_ID'],
secret_access_key=os.environ['AWS_SECRET_ACCESS_KEY'],
region_id='YOUR_REGION_ID',
cluster_id='YOUR_CLUSTER_ID')
token = tokeks.get_token()
CLI usage
-
Go to project directory
-
Run script:
TOKEN=$(./getekstoken us-west-1 cluster-1)
- Verify Kubernetes API access:
APISERVER=...
curl -X GET $APISERVER/api --header "Authorization: Bearer $TOKEN" --insecure
If the response is something like:
{
"kind": "APIVersions",
"versions": [
"v1"
],
"serverAddressByClientCIDRs": [
{
"clientCIDR": "0.0.0.0/0",
"serverAddress": "..."
}
]
}
(and does not contain "Unauthorized"), you're good to go!
Inspired by:
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
No source distribution files available for this release.See tutorial on generating distribution archives.
Built Distribution
tokeks-0.1.1-py3-none-any.whl
(4.9 kB
view hashes)