aws-eks-cluster-controller

module
v0.2.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 21, 2019 License: Apache-2.0

README

CircleCI

AWS EKS Cluster Controller

The aws-eks-cluster-controller manages cross account EKS clusters and supported Kubernetes resources.

This controller is built using the kubebuilder framework. For more information read their docs

Concepts

  • Parent EKS Cluster: The Kubernetes cluster where this controller runs.
  • Child EKS Clusters: These are the Kubernetes clusters managed by the controller running in parent EKS cluster.

Turn Key Installation

Prerequisites

Make sure you have following tools installed on your workstation:

  1. aws-cli
  2. kubectl
  3. eksctl
  4. jq
  5. aws-iam-authenticator
  6. kubebuilder - install step

-- or on MacOS via brew --

brew tap weaveworks/tap/eksctl
brew install kustomize kubernetes-cli eksctl awscli jq
go get -u -v github.com/kubernetes-sigs/aws-iam-authenticator/cmd/aws-iam-authenticator

And install kubebuilder

IMPORTANT make sure your AWS user/role has sufficient permissions to use eksctl.

Setup Parent EKS cluster
  1. Create the Parent EKS cluster

    eksctl create cluster
    
  2. Once eksctl has finished, verify you can access the cluster.

    kubectl get nodes
    
  3. For this installation process we use kube2iam to manage IAM permissions for pods running on the parent cluster.

    kubectl apply -f deploy/kube2iam.yaml
    
Build and deploy the Controller
  1. Clone this project

    mkdir -p some/path
    cd some/path
    git clone git@github.com:awslabs/aws-eks-cluster-controller.git
    
  2. Create the IAM role that the controller will use

    export NODE_INSTANCE_ROLE_ARNS=`aws iam list-roles | jq -r --arg reg_exp "^eksctl-.*-NodeInstanceRole-.*$" '.Roles | map(select(.RoleName|test($reg_exp))) | map(.Arn) | join(",")'`; \
    
    aws cloudformation create-stack \
     --stack-name aws-eks-controller-role \
     --capabilities CAPABILITY_IAM CAPABILITY_NAMED_IAM \
     --template-body file://config/setup/aws-eks-cluster-controller-role.yaml \
     --parameters \
       ParameterKey=WorkerArn,ParameterValue="'${NODE_INSTANCE_ROLE_ARNS}'"
    
    export IAMROLEARN=`aws iam get-role --role-name aws-eks-cluster-controller | jq -r .Role.Arn`
    
  3. Create repository and build/push image

    # Create ECR Repository
    aws ecr create-repository --repository-name aws-eks-cluster-controller
    export REPOSITORY=`aws ecr describe-repositories --repository-name aws-eks-cluster-controller | jq -r '.repositories[0].repositoryUri'`
    
    # Build/tag the docker image
    IMG=${REPOSITORY}:latest IAMROLEARN=${IAMROLEARN} make docker-build
    
    # Push the docker image
    aws ecr get-login --no-include-email | bash -
    docker push ${REPOSITORY}:latest
    
  4. Install required Kubernetes CustomResourceDefinitions (CRDs) and deploy controller

    make deploy
    

License

This library is licensed under the Apache 2.0 License.

Directories

Path Synopsis
cmd
pkg
apis
Package apis contains Kubernetes API groups.
Package apis contains Kubernetes API groups.
apis/cluster
Package cluster contains cluster API versions
Package cluster contains cluster API versions
apis/cluster/v1alpha1
Package v1alpha1 contains API Schema definitions for the cluster v1alpha1 API group +k8s:openapi-gen=true +k8s:deepcopy-gen=package,register +k8s:conversion-gen=github.com/awslabs/aws-eks-cluster-controller/pkg/apis/cluster +k8s:defaulter-gen=TypeMeta +groupName=cluster.eks.amazonaws.com Package v1alpha1 contains API Schema definitions for the cluster v1alpha1 API group +k8s:openapi-gen=true +k8s:deepcopy-gen=package,register +k8s:conversion-gen=github.com/awslabs/aws-eks-cluster-controller/pkg/apis/cluster +k8s:defaulter-gen=TypeMeta +groupName=cluster.eks.amazonaws.com
Package v1alpha1 contains API Schema definitions for the cluster v1alpha1 API group +k8s:openapi-gen=true +k8s:deepcopy-gen=package,register +k8s:conversion-gen=github.com/awslabs/aws-eks-cluster-controller/pkg/apis/cluster +k8s:defaulter-gen=TypeMeta +groupName=cluster.eks.amazonaws.com Package v1alpha1 contains API Schema definitions for the cluster v1alpha1 API group +k8s:openapi-gen=true +k8s:deepcopy-gen=package,register +k8s:conversion-gen=github.com/awslabs/aws-eks-cluster-controller/pkg/apis/cluster +k8s:defaulter-gen=TypeMeta +groupName=cluster.eks.amazonaws.com
apis/components
Package components contains components API versions
Package components contains components API versions
apis/components/v1alpha1
Package v1alpha1 contains API Schema definitions for the components v1alpha1 API group +k8s:openapi-gen=true +k8s:deepcopy-gen=package,register +k8s:conversion-gen=github.com/awslabs/aws-eks-cluster-controller/pkg/apis/components +k8s:defaulter-gen=TypeMeta +groupName=components.eks.amazonaws.com Package v1alpha1 contains API Schema definitions for the components v1alpha1 API group +k8s:openapi-gen=true +k8s:deepcopy-gen=package,register +k8s:conversion-gen=github.com/awslabs/aws-eks-cluster-controller/pkg/apis/components +k8s:defaulter-gen=TypeMeta +groupName=components.eks.amazonaws.com
Package v1alpha1 contains API Schema definitions for the components v1alpha1 API group +k8s:openapi-gen=true +k8s:deepcopy-gen=package,register +k8s:conversion-gen=github.com/awslabs/aws-eks-cluster-controller/pkg/apis/components +k8s:defaulter-gen=TypeMeta +groupName=components.eks.amazonaws.com Package v1alpha1 contains API Schema definitions for the components v1alpha1 API group +k8s:openapi-gen=true +k8s:deepcopy-gen=package,register +k8s:conversion-gen=github.com/awslabs/aws-eks-cluster-controller/pkg/apis/components +k8s:defaulter-gen=TypeMeta +groupName=components.eks.amazonaws.com
aws
clientset/versioned
This package has the automatically generated clientset.
This package has the automatically generated clientset.
clientset/versioned/fake
This package has the automatically generated fake clientset.
This package has the automatically generated fake clientset.
clientset/versioned/scheme
This package contains the scheme of the automatically generated clientset.
This package contains the scheme of the automatically generated clientset.
clientset/versioned/typed/cluster/v1alpha1
This package has the automatically generated typed clients.
This package has the automatically generated typed clients.
clientset/versioned/typed/cluster/v1alpha1/fake
Package fake has the automatically generated clients.
Package fake has the automatically generated clients.
clientset/versioned/typed/components/v1alpha1
This package has the automatically generated typed clients.
This package has the automatically generated typed clients.
clientset/versioned/typed/components/v1alpha1/fake
Package fake has the automatically generated clients.
Package fake has the automatically generated clients.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL