get-kube
is a CLI tool designed to retrieve Kubernetes authentication tokens from various environments and update the local .kube/config
file. It supports EKS clusters, EC2-hosted Kubernetes and Kind clusters.
Before using get-kube
, ensure you have the following tools installed:
- Kind: For running local Kubernetes clusters using Docker container nodes.
- AWS CLI: Required for interacting with Amazon EKS and EC2.
- Kubectl: Kubernetes command-line tool.
You can install these dependencies using package managers like apt
for Linux, brew
for macOS, or by downloading them from their respective official websites.
- AWS Account: Ensure you have an AWS account and are authenticated.
- SSH Private key: Ensure you have SSH Private key for your instances.
- Environment Variables: Set up the following environment variables:
AWS_ACCESS_KEY_ID
: Your AWS access key.AWS_SECRET_ACCESS_KEY
: Your AWS secret key.AWS_DEFAULT_REGION
: The default AWS region (e.g.,us-west-1
).
To fetch tokens from all EKS clusters you have access to:
get-kube eks
To fetch tokens from a Kubernetes cluster hosted on an EC2 instance, provide the master node's name, IP, or FQDN:
get-kube ec2 <master-node-name/IP/FQDN>
To fetch tokens from all local Kind clusters:
get-kube kind
To build for Linux:
make build
After building, make the binary executable:
chmod a+x ./dist/get-kube_linux_amd64/get-kube
Then, install the binary:
sudo mv ./dist/get-kube_linux_amd64/get-kube /usr/local/bin/
To build for macOS:
make build
After building, make the binary executable:
chmod a+x ./dist/get-kube_darwin_arm64/get-kube
Then, install the binary:
sudo mv ./dist/get-kube_darwin_arm64/get-kube /usr/local/bin/
If you wish to extend the functionality of get-kube
, follow these steps:
- Setup the Development Environment: Ensure you have Go installed and set up on your machine.
- Clone the Repository:
git clone https://github.com/hemzaz/get-kube.git
- Navigate to the Code Directory:
cd get-kube
- Make Changes: Add new features or modify existing ones in the
pkg
directory or the main application in thecmd
directory. - Build and Test: Use the provided
Makefile
to build and test your changes. - Contribute: If you believe your changes could benefit others, consider creating a pull request to merge your changes back into the main repository.
Authored by: hemzaz the frogodile πΈπ