Coder Social home page Coder Social logo

aws-svc-controller's Introduction

AWS Service Controller

NOTE: This is just a practice for developing a Kubernetes controller. Not for production.

Purpose

Create a Kubernetes Service for AWS EC2 private IPs.

You might be familiar with the scenario below which an AWS user mixing Kubernetes with VM-base apps.

User Scenario

The concept is using a CRD, AWSService as a L4 proxy against AWS EC2 instances. So that we can expand our service mesh scope not only in the Kubernetes cluster but AWS EC2 instances.

Expected Design

Setup

NOTE: the aws-svc-controller must have the AWS permissions to list and describe EC2 instances.

# will create a namespace, aws-system. and run a controller pod inside.
$ kubectl apply -f aws-svc-controller.yaml

Use

# Create an AWSService
$ cat <<EOF | kubectl apply -f -
apiVersion: earou.io/v1
kind: AWSService
metadata:
  name: ec2-foo-svc
spec:
  port: 80
  targetPort: 80
  selector:
    awsTagName: ec2/app
    awsTagValue: foo
EOF

# Check status
$ kubectl get awsservice,svc,ep

Local Dev Test

Prepare CRD at your k8s cluster.

$ kubectl apply -f crd.yaml

Run controller at local.

$ docker run --rm -d \
    -e AWS_REGION={ aws access key } \
    -e AWS_ACCESS_KEY_ID={ aws access key } \
    -e AWS_SECRET_ACCESS_KEY={ aws secret key } \
    -e KUBE_HOST={ kubernetes api server host } \
    -e TOKEN={ service account token for aws-svc-controller } \
    earou/aws-svc-controller:latest

aws-svc-controller's People

Contributors

earouh avatar

Stargazers

fripig avatar  avatar  曾義格 avatar Rick Hwang avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.