Code Monkey home page Code Monkey logo

kubeadm-aws's Introduction

Simple Nodeless Kubernetes Cluster with Milpa and Kiyot

Note: this is based on upmc-enterprises/kubeadm-aws.

This is a Terraform configuration for provisioning a simple nodeless Kubernetes cluster that uses Milpa and Kiyot. Milpa is a nodeless engine developed by Elotl and Kiyot is a CRI that plugs Milpa into Kubernetes. The script will create a new VPC and subnet then create a nodeless kubernets cluster inside the VPC.

Setup

Create a file at ~/env.tfvars:

$ cp env.tfvars.example ~/env.tfvars
$ vi ~/env.tfvars

Once you have filled in the necessary variables in env.tfvars, apply the configuration:

$ terraform init # Only needed the first time.
[...]
$ terraform apply -var-file ~/env.tfvars
[...]
Apply complete! Resources: 24 added, 0 changed, 0 destroyed.

Outputs:

master_ip = 3.81.184.107
worker_ip = 54.90.138.204

This will create a cluster with one master and one worker.

Inline-style: alt text

SSH into the master node and check the status of the cluster:

ubuntu@ip-10-0-100-66:~$ kubectl cluster-info
Kubernetes master is running at https://10.0.100.66:6443
KubeDNS is running at https://10.0.100.66:6443/api/v1/namespaces/kube-system/services/kube-dns:dns/proxy

To further debug and diagnose cluster problems, use 'kubectl cluster-info dump'.
ubuntu@ip-10-0-100-66:~$ kubectl get nodes
NAME              STATUS   ROLES    AGE   VERSION
ip-10-0-100-135   Ready    <none>   62s   v1.14.0
ip-10-0-100-66    Ready    master   97s   v1.14.0
ubuntu@ip-10-0-100-66:~$

At this point, the cluster is ready to use.

Run a Pod

Stateless pods (no persistent volume claims or locally attached volumes) will be scheduled via Milpa. For example:

ubuntu@ip-10-0-100-66:~$ kubectl run nginx --image=nginx

will run the pod(s) created by the deployment via Milpa.

If you have both Milpa and non-Milpa workers in your cluster, you can also use a nodeSelector to assign a pod to a non-Milpa worker. Label your non-Milpa worker node with e.g. mycompany.com/worker, then add a nodeselector:

spec:
  nodeSelector:
    mycompany.com/worker: ""

Teardown

Make sure all pods and services are removed. On the master:

ubuntu@ip-10-0-100-66:~$ for ns in $(kubectl get namespaces | tail -n+2 | awk '{print $1}'); do kubectl delete --all deployments --namespace=$ns; kubectl delete --all services --namespace=$ns; kubectl delete --all daemonsets --namespace=$ns; kubectl delete --all pods --namespace=$ns; done
No resources found
service "kubernetes" deleted
No resources found
No resources found
[...]
ubuntu@ip-10-0-100-66:~$

Then you can log out from the master, and use Terraform to tear down the infrastructure:

$ terraform destroy -var-file ~/env.tfvars
[...]
Plan: 0 to add, 0 to change, 24 to destroy.

Do you really want to destroy all resources?
  Terraform will destroy all your managed infrastructure, as shown above.
  There is no undo. Only 'yes' will be accepted to confirm.

  Enter a value: yes

[...]

Destroy complete! Resources: 24 destroyed.

kubeadm-aws's People

Contributors

ldx avatar justnoise avatar stevesloka avatar myechuri avatar rokka-n avatar athirn avatar remram44 avatar

Watchers

James Cloos 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.