cakab / ekscli

A command line tool for AWS EKS management
MIT License
3 stars 1 forks source link
aws eks kubernetes kubernetes-deployment

======= ekscli

|Build Status| |Docs| |Version| |License|

.. |Build Status| image:: https://api.travis-ci.com/cakab/ekscli.svg?branch=master :target: https://travis-ci.org/cakab/ekscli :alt: Build Status

.. |Docs| image:: https://readthedocs.org/projects/ekscli/badge/?version=latest :target: https://ekscli.readthedocs.io/en/latest/?badge=latest :alt: Documentation Status

.. |Version| image:: https://img.shields.io/pypi/v/ekscli.svg :target: https://pypi.python.org/pypi/ekscli

.. |License| image:: https://img.shields.io/badge/License-MIT-yellow.svg :target: https://opensource.org/licenses/MIT :alt: License MIT

A simple and flexible command-line tool for AWS EKS management


Prerequisites


Quick Start

Installation

As easy as the standard python way by using pip <https://pip.pypa.io/en/latest/>_.

.. code-block:: bash

$ pip install ekscli

Optionally, after installation, command-completion can be achieved with:

.. code-block:: bash

$ eval "$(_EKS_COMPLETE=source eks)"
Use ECKCLI

Note: AWS fees will be charged in your account for the AWS resources created by ekscli.

| The simplest way to create a cluster by running ekscli with almost everything default. | This will create an EKS cluster including the control plane (managed master by AWS), a node group and a kubectl configuration file (KUBECONFIG or $HOME/.kube/config).

.. code-block:: bash

$ eks create cluster --name=dev

# EKS cluster name can be set as an environment variable
$ export EKS_CLUSTER_NAME=dev
$ eks create cluster

To create the EKS cluster's control plane (master) only:

.. code-block:: bash

$ eks create cluster --name=dev --cp-only

To create the EKS cluster's control plane (master) with existing subnets of a VPC, a predefined IAM role, an existing EC2 KeyPair etc.:

.. code-block:: bash

$ eks create cluster --name=dev --cp-only \
  --subnets=subnet-1234567,subnet-abcdef1 \
  --cp-role eks-default-role \
  --region us-west-2 \
  --kubconfig ./dev.conf \
  --heptio-auth /tmp/heptio-auth-aws \
  --keyname dev \
  --node-sg-ingress port=22,cidr=10.0.0.0/8 \
  --tags Env=dev,Project=eks-poc

The simplest way to create a node group

.. code-block:: bash

$ eks create node-group --name=dev --node-name=workers

To create a node group with more options

.. code-block:: bash

$ eks create node-group --name=dev --node-name=another \
  --node-role=eks-worker-s3 \
  --node-subnets=subnet-1234567 \
  --node-min=1 \
  --node-max=10
  --node-sg-ingress port=22,cidr=10.0.0.0/8 \
  --node-sg-ingress protocol=tcp,from=8080,to=8088,cidr=0.0.0.0/0 \
  --region us-west-2 \
  --kubconfig ./dev.conf \
  --heptio-auth /tmp/heptio-auth-aws \
  --keyname dev \
  --tags Env=dev,Project=eks-poc

To help bootstrapping kubelet agent

.. code-block:: bash

# on EC2 worker instances, after copying kubelet, cni, heptio-aws-authenticator executables
$ eks bootstrap -o node-labels=gpu=enable,role=node \
  -o feature-gates=RotateKubeletServerCertificate=true,CRIContainerLogRotation=true
$ systemctl daemon-reload
$ systemctl enable kubelet.service

To display files created by ekscli boostrap locally rather than on EC2 instances

.. code-block:: bash

# on local machine 
$ eks bootstrap --dry-run -n poc -r us-east-1 -m 32 -i 127.0.0.1 \
  -o node-labels=gpu=enable,role=node \
  -o feature-gates=RotateKubeletServerCertificate=true,CRIContainerLogRotation=true

To use ekscli boostrap as oneshot systemd unit

.. code-block:: linux-config

[Unit]
Description=Configures Kubelet for EKS worker nodes
Before=kubelet.service

[Service]
Type=oneshot
ExecStart=/usr/local/bin/ekscli bootstrap
RemainAfterExit=true

[Install]
WantedBy=multi-user.target

Features


Roadmap