Skip to content

Python module that generates token to authenticate against a Kubernetes EKS Cluster

Notifications You must be signed in to change notification settings

overdrive3000/eksauth

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 

Repository files navigation

EKS Auth

This is a simple python module that generates a token compatible with Heptio IAM Authenticator.

Using this module you can authenticate against an EKS cluster from a python script without the need of the heptio authenticator binary

Usage

from eksauth import auth
from kubernetes import client, config

# Get EKS auth token
eks = auth.EKSAuth('TestBed')
token = eks.get_token()

# Load kubernetes configuration
config.load_kube_config()
configuration = client.Configuration()
configuration.api_key['authorization'] = token
configuration.api_key_prefix['authorization'] = 'Bearer'


api = client.ApiClient(configuration)
v1 = client.CoreV1Api(api)

ret = v1.list_pod_for_all_namespaces(watch=False)

for i in ret.items:
    print("%s\t%s\t%s" % (i.status.pod_ip, i.metadata.namespace, i.metadata.name))

TODO

  • Add Docstrings
  • Add Error Handling
  • Create Tests
  • Create package

About

Python module that generates token to authenticate against a Kubernetes EKS Cluster

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages