Metadata-Version: 2.1
Name: kubetwo
Version: 0.4.0
Summary: Simple CLI tool to create Kubernetes cluster on AWS EC2.
Home-page: https://github.com/opeco17/kubetwo
Author: opeco17
License: Apache License 2.0
Description: # kubetwo
        kubetwo is a simple CLI tool to create Kubernetes clusters on AWS EC2 with just one command.
        
        kubetwo will interact with Terraform and Ansible (Kubespray) for provisioning.
        
        # Requirements
        To use kubetwo, following tools are necessary.
        
         - [Python (3.6 and newer)](https://www.python.org/downloads/)
         - [Terraform (1.0.0 and newer)](https://learn.hashicorp.com/tutorials/terraform/install-cli)
        
        # Quick Start
        ## 1. Prerequisites
        First, please install `kubetwo` package using pip or pip3 depending on your environment.
        
        ```sh
        pip install kubetwo
        ```
        
        For kubetwo to interact with Terraform, it's necessary to set environment variables about AWS credentials. 
        
        ```sh
        export AWS_ACCESS_KEY_ID="your_anaccesskey"
        export AWS_SECRET_ACCESS_KEY="your_asecretkey"
        export AWS_DEFAULT_REGION="your_region"
        ```
        
        Then, you need to create SSH key without password for Ansible to access the EC2.
        
        ```sh
        ssh-keygen -t rsa -b 4096 -f ~/.ssh/kubetwo_id_rsa
        ```
        
        Then set these SSH keys as environment variables.
        ```sh
        export SSH_PUBLIC_KEY_PATH="~/.ssh/kubetwo_id_rsa.pub"
        export SSH_PRIVATE_KEY_PATH="~/.ssh/kubetwo_id_rsa"
        ```
        
        ## 2 Spin up Kubernetes cluster
        By running the following `kubetwo create` command, kubetwo will spin up AWS EC2 with Terraform and set up Kubernetes cluster with Ansible ([Kubespray v2.16.0](https://github.com/kubernetes-sigs/kubespray/tree/release-2.16)).
        
        ```sh
        kubetwo create --cluster-name kubetwo-cluster
        ```
        
        ## 3. Access to the Kubernetes cluster
        After the Kubernetes cluster is created, you can see admin.conf in the workspace.
        Setting `KUBECONFIG` will allow you to access the Kubernetes cluster.
        
        ```sh
        export KUBECONFIG=$(pwd)/kubetwo_cluster/admin.conf
        ```
        
        Let's check the Kubernetes cluster from your local machine. (If you don't have `kubectl`, please install it)
        
        ```sh
        kubectl get nodes
        ```
        
        ## 4. Clean up
        You can clean up newly created resources with `kubetwo delete` command.
        It will also delete workspace of kubetwo on your machine.
        
        ```sh
        kubetwo delete --cluster-name kubetwo-cluster
        ```
        
        # Commands
        
        ## kubetwo create
        It will spin up AWS EC2 and create Kubernetes cluster.
        
        ### Parameters
        
        | Name | Type | Default | Description |
        | :---: | :---: | :---: | :--- |
        | cluster-name | string | - | Kubernetes cluster name |
        | ami | string | ami-0c3fd0f5d33134a76 | Amazon Machine Image of EC2 instance |
        | instance-type | string | t3.medium | Instance type of EC2 instance |
        | control-plane | int | 1 | Number of control planes |
        | worker-node | int | 1 | Number of worker nodes |
        | open-ports | string | 80,443 | Worker node ports to open for global (-1 will open all ports) |
        | approve | boolean | false | If true, kubetwo won't prompt you to approve for execution |
        
        ### Example
        ```sh
        kubetwo create \
        --cluster-name kubetwo-cluster \
        --control-plane 1 \
        --worker-node 1 \
        --open-ports 80,443
        ```
        
        ## kubetwo scale
        It will scale in/out worker nodes in Kubernetes cluster.
        
        ### Parameters
        
        | Name | Type | Default | Description |
        | :---: | :---: | :---: | :--- |
        | cluster-name | string | - | Kubernetes cluster name |
        | worker-node | int | - | Number of worker nodes |
        | approve | boolean | false | If true, kubetwo won't prompt you to approve for execution |
        
        ### Example
        ```sh
        kubetwo scale --cluster-name kubetwo-cluster --worker-node 2
        ```
        
        ## kubetwo delete
        It will remove newly created AWS resources and Kubernetes cluster. And also clean up the workspace of kubetwo on local machine.
        
        ### Parameters
        
        | Name | Type | Default | Description |
        | :---: | :---: | :---: | :--- |
        | cluster-name | string | - | Kubernetes cluster name |
        | approve | boolean | false | If true, kubetwo won't prompt you to approve for execution |
        
        ### Example
        ```sh
        kubetwo delete --cluster-name kubetwo-cluster
        ```
        
Keywords: kubetwo kube-two kube2 kube-2
Platform: UNKNOWN
Classifier: License :: OSI Approved :: Apache Software License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.6
Classifier: Programming Language :: Python :: 3.7
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Classifier: Intended Audience :: Developers
Classifier: Intended Audience :: Information Technology
Requires-Python: >= 3.6
Description-Content-Type: text/markdown
