├── cloud └── aws │ └── ami │ └── ubuntu │ └── 20.04 │ ├── ami-ssh-key.pub │ ├── README.md │ └── packer.json ├── dockerImages └── ubuntu │ └── 20.04 │ ├── run.sh │ ├── README.md │ └── Dockerfile ├── .github └── workflows │ ├── docker_build_ubuntu_20.04.yaml │ └── packer-build.yaml ├── notes.md ├── README.md └── LICENSE /cloud/aws/ami/ubuntu/20.04/ami-ssh-key.pub: -------------------------------------------------------------------------------- 1 | # Place your ssh public key in here. This will be copied over to the AMI that is being built. This is a good way to troubleshoot AMI builds. 2 | -------------------------------------------------------------------------------- /dockerImages/ubuntu/20.04/run.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Starting up services 4 | service docker start 5 | service ssh start 6 | 7 | # while loop to hold the container in a running state 8 | while true; do sleep 10; done 9 | -------------------------------------------------------------------------------- /dockerImages/ubuntu/20.04/README.md: -------------------------------------------------------------------------------- 1 | ## Build with default values 2 | ``` 3 | docker build Dockerfile 4 | ``` 5 | 6 | ## Build with args 7 | 8 | ``` 9 | docker build --build-arg terraform_version="0.13.3" --build-arg terragrunt_version="0.26.7" -t managekube/dev-box-ubuntu:0.0.1 Dockerfile 10 | ``` 11 | -------------------------------------------------------------------------------- /cloud/aws/ami/ubuntu/20.04/README.md: -------------------------------------------------------------------------------- 1 | Packer Build 2 | =========== 3 | 4 | ## Building the image locally: 5 | 6 | Set your AWS keys: 7 | ```bash 8 | export AWS_ACCESS_KEY_ID="xxxx" 9 | export AWS_SECRET_ACCESS_KEY="xxx" 10 | ``` 11 | 12 | Set environment variables used by Packer 13 | ```bash 14 | export BUILD_VPC_ID="vpc-06fd30fb9a086b95d" 15 | export BUILD_SUBNET_ID="subnet-0c7b0058c2220a2b0" 16 | export AWS_REGION="us-east-1" 17 | ``` 18 | 19 | Execut Packer: 20 | ```bash 21 | packer validate 22 | 23 | packer build 24 | ``` 25 | 26 | This will launch a machine in AWS and run the packer build. 27 | -------------------------------------------------------------------------------- /.github/workflows/docker_build_ubuntu_20.04.yaml: -------------------------------------------------------------------------------- 1 | name: ci 2 | 3 | on: 4 | push: 5 | branches: 6 | - '**' 7 | tags: 8 | - 'v*.*.*' 9 | 10 | jobs: 11 | main: 12 | runs-on: ubuntu-latest 13 | steps: 14 | - 15 | name: Set branch env 16 | run: echo "BRANCH=${GITHUB_REF##*/}" >> $GITHUB_ENV 17 | - 18 | name: Set up QEMU 19 | uses: docker/setup-qemu-action@v1 20 | - 21 | name: Set up Docker Buildx 22 | uses: docker/setup-buildx-action@v1 23 | - 24 | name: Login to DockerHub 25 | uses: docker/login-action@v1 26 | with: 27 | username: ${{ secrets.DOCKERHUB_USERNAME }} 28 | password: ${{ secrets.DOCKERHUB_TOKEN }} 29 | - 30 | name: Build and push 31 | id: docker_build 32 | uses: docker/build-push-action@v2 33 | with: 34 | # context: ./dockerImages/ubuntu/20.04 35 | file: ./dockerImages/ubuntu/20.04/Dockerfile 36 | push: true 37 | tags: managekube/dev-box-ubuntu-20-04:${{ env.BRANCH }} 38 | build-args: | 39 | BRANCH=${{ env.BRANCH }} 40 | - 41 | name: Image digest 42 | run: echo ${{ steps.docker_build.outputs.digest }} 43 | -------------------------------------------------------------------------------- /.github/workflows/packer-build.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | 3 | name: Packer 4 | 5 | # on: 6 | # push: 7 | on: 8 | release: 9 | types: [created] 10 | 11 | jobs: 12 | packer: 13 | runs-on: ubuntu-latest 14 | name: packer 15 | 16 | steps: 17 | - name: Checkout Repository 18 | uses: actions/checkout@v2 19 | 20 | # fix backwards incompatibilities in template 21 | # - name: Fix Template 22 | # uses: operatehappy/packer-github-actions@master 23 | # with: 24 | # command: fix 25 | 26 | # validate templates 27 | - name: Validate Template 28 | uses: operatehappy/packer-github-actions@master 29 | with: 30 | command: validate 31 | arguments: -syntax-only 32 | working_directory: ./cloud/aws/ami/ubuntu/20.04 33 | target: packer.json 34 | 35 | # build artifact 36 | - name: Build Artifact 37 | uses: operatehappy/packer-github-actions@master 38 | env: 39 | AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} 40 | AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} 41 | BUILD_VPC_ID: "vpc-06fd30fb9a086b95d" 42 | BUILD_SUBNET_ID: "subnet-0c7b0058c2220a2b0" 43 | AWS_REGION: "us-east-1" 44 | with: 45 | command: build 46 | arguments: "-color=false -on-error=abort" 47 | working_directory: ./cloud/aws/ami/ubuntu/20.04 48 | target: packer.json 49 | 50 | # additional steps to process artifacts -------------------------------------------------------------------------------- /dockerImages/ubuntu/20.04/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM ubuntu:20.04 2 | 3 | RUN apt-get update 4 | 5 | # Install Docker 6 | # Doc: https://docs.docker.com/engine/install/ubuntu/#install-using-the-repository 7 | RUN apt-get install -y \ 8 | apt-transport-https \ 9 | ca-certificates \ 10 | curl \ 11 | gnupg-agent \ 12 | software-properties-common 13 | 14 | RUN curl -fsSL https://download.docker.com/linux/ubuntu/gpg | apt-key add - 15 | 16 | RUN add-apt-repository \ 17 | "deb [arch=amd64] https://download.docker.com/linux/ubuntu \ 18 | $(lsb_release -cs) \ 19 | stable" 20 | 21 | RUN apt-get update 22 | RUN apt-get install -y docker-ce docker-ce-cli containerd.io 23 | 24 | # Input args 25 | ARG kubectl_version="installing the latest" 26 | ARG terraform_version="0.13.3" 27 | ARG terragrunt_version="0.26.7" 28 | ARG aws_cli_version="installing the latest" 29 | ARG saml2aws_version="2.27.1" 30 | ARG kind_version="v0.7.0" 31 | ARG golang_version="1.15.7" 32 | 33 | # Envars 34 | ENV TERRAFORM_VERSION=$terraform_version 35 | ENV TERRAGRUNT_VERSION=$terragrunt_version 36 | ENV SAML2AWS_VERSION=$saml2aws_version 37 | ENV KIND_VERSION=$kind_version 38 | ENV GOLANG_VERSION=$golang_version 39 | 40 | # Update the base image and install base items 41 | RUN apt-get update 42 | RUN apt-get install -y vim wget curl ssh zip build-essential git bash-completion 43 | 44 | # Add bash auto completion 45 | RUN echo "source /etc/profile.d/bash_completion.sh" >> ~/.bashrc 46 | 47 | # Working dir 48 | WORKDIR /tmp 49 | 50 | # Install golang 51 | RUN wget https://golang.org/dl/go${GOLANG_VERSION}.linux-amd64.tar.gz 52 | RUN tar -C /usr/local -xzf go${GOLANG_VERSION}.linux-amd64.tar.gz 53 | ENV PATH "$PATH:/usr/local/go/bin" 54 | RUN echo "export PATH=/usr/local/go/bin:$PATH" >> /root/.bashrc 55 | RUN go get golang.org/x/tools/gopls 56 | RUN go get -v github.com/go-delve/delve/cmd/dlv 57 | 58 | # Install kubectl 59 | RUN apt-get update && apt-get install -y apt-transport-https gnupg2 curl 60 | RUN curl -s https://packages.cloud.google.com/apt/doc/apt-key.gpg | apt-key add - 61 | RUN echo "deb https://apt.kubernetes.io/ kubernetes-xenial main" | tee -a /etc/apt/sources.list.d/kubernetes.list 62 | RUN apt-get update 63 | RUN apt-get install -y kubectl 64 | 65 | # Install Terraform 66 | RUN wget https://releases.hashicorp.com/terraform/${TERRAFORM_VERSION}/terraform_${TERRAFORM_VERSION}_linux_amd64.zip 67 | RUN unzip terraform_${TERRAFORM_VERSION}_linux_amd64.zip 68 | RUN cp /tmp/terraform /usr/local/bin/terraform 69 | 70 | # Install Terragrunt 71 | RUN wget https://github.com/gruntwork-io/terragrunt/releases/download/v${TERRAGRUNT_VERSION}/terragrunt_linux_amd64 72 | RUN chmod 755 ./terragrunt_linux_amd64 73 | RUN cp terragrunt_linux_amd64 /usr/local/bin/terragrunt 74 | 75 | # Install saml2aws 76 | # RUN wget https://github.com/Versent/saml2aws/releases/download/v${SAML2AWS_VERSION}/saml2aws_${SAML2AWS_VERSION}_linux_amd64.tar.gz 77 | # RUN tar -zxvf saml2aws_${SAML2AWS_VERSION}_linux_amd64.tar.gz 78 | # RUN cp saml2aws /usr/local/bin/saml2aws 79 | 80 | # Install aws cli 81 | RUN curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip" 82 | RUN unzip awscliv2.zip 83 | RUN ./aws/install 84 | 85 | # Install KinD 86 | RUN curl https://github.com/kubernetes-sigs/kind/releases/download/${KIND_VERSION}/kind-linux-amd64 -o /usr/local/bin/kind -L 87 | RUN chmod +x /usr/local/bin/kind 88 | 89 | ADD ./dockerImages/ubuntu/20.04/run.sh /run.sh 90 | 91 | ENTRYPOINT [ "/run.sh" ] 92 | -------------------------------------------------------------------------------- /cloud/aws/ami/ubuntu/20.04/packer.json: -------------------------------------------------------------------------------- 1 | { 2 | "variables": { 3 | "vpc": "{{env `BUILD_VPC_ID`}}", 4 | "subnet": "{{env `BUILD_SUBNET_ID`}}", 5 | "aws_region": "{{env `AWS_REGION`}}", 6 | "ami_name": "managedkube-kops-{{isotime \"2006-01-02-03-04-05\"}}", 7 | "source_repo": "kubernetes-development-environment-in-a-box", 8 | "source_location": "cloud/aws/ami/ubuntu/20.04", 9 | "instance_type": "t2.large", 10 | "ssh_username": "ubuntu", 11 | "ami_description": "Ubuntu 20.04" 12 | }, 13 | "builders": [{ 14 | "name": "AWS AMI Builder", 15 | "type": "amazon-ebs", 16 | "region": "{{user `aws_region`}}", 17 | "source_ami_filter": { 18 | "filters": { 19 | "virtualization-type": "hvm", 20 | "architecture": "x86_64", 21 | "name": "ubuntu/images/hvm-ssd/ubuntu-focal-20.04-amd64-server-20210119.*", 22 | "block-device-mapping.volume-type": "gp2", 23 | "root-device-type": "ebs" 24 | }, 25 | "owners": ["099720109477"], 26 | "most_recent": true 27 | }, 28 | "ami_regions": [ 29 | "{{user `aws_region`}}" 30 | ], 31 | "instance_type": "{{user `instance_type`}}", 32 | "ssh_username": "{{user `ssh_username`}}", 33 | "ami_name": "{{user `ami_name` }}", 34 | "encrypt_boot": true, 35 | "tags": { 36 | "Name": "{{user `ami_name`}}", 37 | "source_repo": "{{user `source_repo`}}", 38 | "source_location": "{{user `source_location`}}" 39 | }, 40 | "run_tags": { 41 | "Name": "{{user `ami_name`}}" 42 | }, 43 | "run_volume_tags": { 44 | "Name": "{{user `ami_name`}}" 45 | }, 46 | "snapshot_tags": { 47 | "Name": "{{user `ami_name`}}" 48 | }, 49 | "ami_description": "{{user `ami_description`}}", 50 | "associate_public_ip_address": "true", 51 | "vpc_id": "{{user `vpc`}}", 52 | "subnet_id": "{{user `subnet`}}" 53 | }], 54 | "provisioners": [ 55 | { 56 | "type": "file", 57 | "source": "./ami-ssh-key.pub", 58 | "destination": "/tmp/ami-ssh-key.pub" 59 | }, 60 | { 61 | "type": "shell", 62 | "inline": [ 63 | "cat /tmp/ami-ssh-key.pub >> ~/.ssh/authorized_keys", 64 | "cd /tmp", 65 | "sudo apt-get update", 66 | "#sudo apt-get upgrade -y", 67 | "# sudo apt-get dist-upgrade -y", 68 | "# Installing AWS Inspector: https://docs.aws.amazon.com/inspector/latest/userguide/inspector_installing-uninstalling-agents.html#install-linux", 69 | "# wget https://inspector-agent.amazonaws.com/linux/latest/install", 70 | "# chmod 755 install", 71 | "# sudo ./install", 72 | "# sudo /opt/aws/awsagent/bin/awsagent status", 73 | "# Install Docker", 74 | "sudo apt-get install -y apt-transport-https ca-certificates", 75 | "curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -", 76 | "sudo add-apt-repository \"deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable\"", 77 | "sudo apt-get update", 78 | "# echo 'Docker version list'", 79 | "sudo apt-cache madison docker-ce", 80 | "sudo apt-get install -y docker-ce=5:20.10.3~3-0~ubuntu-focal docker-ce-cli=5:20.10.3~3-0~ubuntu-focal containerd.io", 81 | "sudo usermod -aG docker ubuntu", 82 | "# Install nestybox/sysbox", 83 | "# Fixing docker userns-remap setting: https://github.com/nestybox/sysbox/blob/master/docs/user-guide/install.md#docker-userns-remap", 84 | "wget https://github.com/nestybox/sysbox/releases/download/v0.2.1/sysbox_0.2.1-0.ubuntu-focal_amd64.deb", 85 | "sudo DEBIAN_FRONTEND=noninteractive apt-get install ./sysbox_0.2.1-0.ubuntu-focal_amd64.deb -y" 86 | ] 87 | }, 88 | { 89 | "type": "shell", 90 | "inline": [ 91 | "rm .ssh/authorized_keys ; sudo rm /root/.ssh/authorized_keys" 92 | ] 93 | } 94 | ] 95 | } 96 | -------------------------------------------------------------------------------- /notes.md: -------------------------------------------------------------------------------- 1 | Notes 2 | ========= 3 | 4 | 5 | * Install Docker on the host system 6 | * Install sysbox 7 | * https://github.com/nestybox/sysbox#installing-sysbox 8 | 9 | ## Start an Ubuntu container 10 | 11 | ``` 12 | DEV_INSTANCE_IMAGE=managekube/dev-box-ubuntu:0.0.5 13 | DEV_INSTANCE_NAME=dev-1 14 | DEV_INSTANCE_SSH_PORT=20021 15 | USERS_PUBLIC_SSH_KEY="ssh-rsa AAAAB3NzaC1yc2E....." 16 | DEV_INSTANCE_PUBLIC_IP=dev-box-1.managedkube.com 17 | ``` 18 | 19 | Start a dev-box container: 20 | ``` 21 | docker run --runtime=sysbox-runc --name ${DEV_INSTANCE_NAME} --hostname ${DEV_INSTANCE_NAME} -p ${DEV_INSTANCE_SSH_PORT}:22 -d ${DEV_INSTANCE_IMAGE} 22 | ``` 23 | 24 | Add ssh pub key: 25 | ``` 26 | docker exec ${DEV_INSTANCE_NAME} mkdir /root/.ssh 27 | docker exec ${DEV_INSTANCE_NAME} /bin/bash -c "echo ${USERS_PUBLIC_SSH_KEY} >> /root/.ssh/authorized_keys" 28 | ``` 29 | 30 | 31 | ## User Process 32 | As a user, this gives you a Linux server where you can SSH into and develop on. 33 | 34 | ### Test out your connection to your dev instnace: 35 | 36 | Add private key to your ssh agent: 37 | ``` 38 | ssh-add 39 | ``` 40 | * This should be the private key you are going to use to log into the dev box 41 | * This should be the private key you are authenticating to Github with, You can also add more keys to your ssh agent if you are using different keys. 42 | 43 | SSH into their instance: 44 | ``` 45 | ssh root@${DEV_INSTANCE_PUBLIC_IP} -p ${DEV_INSTANCE_SSH_PORT} 46 | ``` 47 | 48 | ### Connect to your dev instance from VSCode: 49 | VSCode has an extension allows you to use SSH from the IDE into a remote server. It will then give you a terminal on that remote server and it can sync files that are on that remote server into your IDE like you were working on the remote server locally. 50 | 51 | Here is the process on how to set that up: 52 | 53 | #### Install the VSCode Remote SSH extention: 54 | 55 | Doc: https://code.visualstudio.com/docs/remote/ssh 56 | 57 | Install the "Remote - SSH" extension 58 | * On the left hand side of the IDE click on "Extensions" 59 | * Search for "Remote - SSH" and install this extension 60 | 61 | #### Configure VSCode to connect to a remote machine 62 | Add host into VScode: 63 | * On the lower left of the VScode window click on "Open Remote Window" 64 | * Click on: Remote-SSH: Connect to Host... 65 | * + Add New SSH Host... 66 | * Add: ssh root@ -A -p 20021 67 | * On the lower left of the VScode window click on "Open Remote Window" 68 | * Click on: Remote-SSH: Open Configuration File... 69 | * Select the `/home//.ssh/config` file 70 | * Find this host: 71 | ``` 72 | Host x.x.x.x 73 | HostName x.x.x.x 74 | User root 75 | Port 20022 76 | ForwardAgent yes 77 | ``` 78 | 79 | * Click on: Remote-SSH: Connect to Host... 80 | * Click on the host you just added and/or renamed. A new VScode window will open up and it will connect to this host. 81 | * In the new window, click on Terminal->New Terminal 82 | * In the terminal 83 | * `cd /home` 84 | * git clone 85 | * In VScode, on the top left click on the "Explorer" icon 86 | * Click on "Open Folder" 87 | * A box will appear asking for the path, put in: `/home/`. 88 | * VScode will reload and the Explorer will show the files of the Git repo you have just cloned. These files are on the remote server but it appears in your VScode like they are local files. 89 | 90 | 91 | 92 | ## Thoughts 93 | 94 | ### Tunnelling to a remote docker server in vscode 95 | 96 | https://code.visualstudio.com/docs/containers/ssh 97 | 98 | * The remote user would connect to this and use this container instead of a local container 99 | * They would still need docker client installed locally 100 | * Working in China wouldnt be a problem for downloading golang packages since this server would be in the US 101 | 102 | This is sounding complicated 103 | 104 | 105 | ### Using the ubuntu sysbox container 106 | 107 | VScode 108 | * You will need to install the Go extention into your dev box environment for code completion to work 109 | 110 | Kubeconfig 111 | * You will need a kubeconfig at: `/root/.kube/config` 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | * kubectl bash completion 120 | * helm 121 | * and helm bash completion 122 | * Bash prompt with git branch 123 | 124 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # kubernetes-development-environment-in-a-box 2 | This project produces an AMI image that can run an instance that has Docker and multiple isolated Kubernetes clusters running in it using [KinD](https://github.com/kubernetes-sigs/kind). The main use case is to setup one node that can run multiple fully isolated Kubernetes cluster on it for development purposes. 3 | 4 | ## What this box has 5 | This box has multiple items in it to help facilitate creating multiple Kubernetes cluster on a single machine. 6 | 7 | ``` 8 | +-----+ +-----+ +-----+ +-----+ +-----+ +-----+ +---------+ +-----------+ 9 | | Pod | | Pod | | Pod | |Pod | |Pod | |Pod | | | | | 10 | | | | | | | | | | | | | | | | | 11 | +-----+ +-----+ +-----+ +-----+ +-----+ +-----+ | | | Regular | 12 | +----------------------+ +---------------------+ | | | Linux | 13 | | Namepaces | | Namepsaces | | | | process or| 14 | +----------------------+ +---------------------+ |Regular | |application| 15 | +----------------------+ +---------------------+ |Container| | | 16 | | KinD | |KinD | | | | | 17 | | +Kubernetes Cluster | | Kubernetes Cluster | | | | | 18 | +----------------------+ +---------------------+ +---------+ | | 19 | +-----------------------------------------------------------+ | | 20 | | | | | 21 | | Docker | | | 22 | +-----------------------------------------------------------+ +-----------+ 23 | +-------------------------------------------------------------------------+ 24 | | Isolated Docker container | 25 | | - Ubuntu 20.04 | 26 | +-------------------------------------------------------------------------+ 27 | +-------------------------------------------------------------------------+ 28 | | Management Layer | 29 | +-------------------------------------------------------------------------+ 30 | +-------------------------------------------------------------------------+ 31 | | Nestybox/Sysbox Docker | 32 | +-------------------------------------------------------------------------+ 33 | +-------------------------------------------------------------------------+ 34 | | Ubuntu 20.04 | 35 | +-------------------------------------------------------------------------+ 36 | +-------------------------------------------------------------------------+ 37 | | Instance / EC2 | 38 | +-------------------------------------------------------------------------+ 39 | +-------------------------------------------------------------------------+ 40 | | Cloud | 41 | +-------------------------------------------------------------------------+ 42 | ``` 43 | (Created with http://asciiflow.com/) 44 | 45 | Starting from the bottom up. 46 | 47 | 1) Cloud 48 | This is the cloud that you are on where you are spinning up the instance. The first supported cloud will be AWS. 49 | 50 | 2) Instance 51 | This is the instance or virtual machine (VM) you are using. 52 | 53 | 3) Ubuntu 20.04 54 | The base image of this machine is running Ubuntu 20.04. It could really run any Linux distro though. 55 | 56 | 4) Nestybox/Sysbox 57 | https://github.com/nestybox/sysbox 58 | 59 | "Sysbox is an open-source container runtime (aka runc), originally developed by Nestybox, that enables Docker containers to act as virtual servers capable of running software such as Systemd, Docker, and Kubernetes in them, easily and with proper isolation. This allows you to use containers in new ways, and provides a faster, more efficient, and more portable alternative to virtual machines in many scenarios." 60 | 61 | We are using this as the Docker isolation layer/tool which allows us to run fully isolated Docker container on this single machine. This is really where the isolation magic is happening here. Everything else is just managment glue to make everything work. This allows us to spin up any number of Ubuntu Docker container on this machine which looks likes VMs. The Ubuntu Docker image we spin up has Docker installed inside of it and [KinD](https://github.com/kubernetes-sigs/kind) CLI which allows us to spin up Kubernetes clusters in this Docker container. 62 | 63 | 5) Management Layer 64 | The management layer is a set of scripts and proccesses to facilitate spinning up and down Kubernetes clusters on this machine. This is the glue that puts everything together. 65 | 66 | 6) Isolated Ubuntu Docker image with KinD installed 67 | And finally we arrive at the end state of what we are after here. A fully isolated KinD cluster running on a machine with other fully isolated KinD clusters. This Docker container acts like a VM. You can SSH into it, you can `apt-get install` stuff, and basically anything else you can do with a VM. 68 | 69 | This Docker container can then instantiate a KinD Kubernetes cluster, other docker containers, or just regular Linux proccesses or applications. Use this like any other VM. The diagram is showing a few possible options here but you can do whatever you like here. You can hand these Ubuntu containers to a developer as a remote machine that they can use and this is cost effective as well since everyone shares one machine. 70 | 71 | While this project is geared toward running multiple isolated KinD cluster on a single instance, fundamentally it is a generic machine that can run any Docker container that are fully isolated from each other. 72 | 73 | ## Use cases 74 | 75 | ### Why would you want to use a development box like this? 76 | Setting up a development environment is hard. Everyone's machine is a little different and everyone likes to configure it a little differently. Using a central development box like this, allows your developers to connect to this central machine where you have more control of how it is setup. This helps you to get your developers productive faster. 77 | 78 | You can setup a container that has everything installed in it from developer's tools to specific libraries that you are using. Each container can even have it's own Kubernetes cluster which means each developer has their own cluster and won't interfere with each other's work. 79 | 80 | ### Use case - New developers 81 | 82 | I have: 83 | * 2 new developers 84 | * Both are going to start on some type of development that involves Kubernetes 85 | * They are both running Windows machine 86 | * Work in a location that makes downloading Golang libraries hard (restricted) 87 | * Not that familiar with Kubernetes and you don't want them to have to set it up locally 88 | * You don't want to play support and would rather have the developer connect to something that is all setup for them 89 | 90 | Kubernetes-development-environment-in-a-box is perfect for this use case. You can setup a machine on AWS, GCP, or Azure and turn on an Ubuntu container for each of them. These containers act more like a VM (see above for an explantion) which means it has a local isolated Docker daemon, you can start a KinD cluster, and install whatever you want into it without affecting the host machine or any other containers on this machine. 91 | 92 | The container you start for this developer is built from a Dockerfile and it has all of the tools and thing you want in it from the get go. So if you wanted Golang 1.14.x it has it or if you want to use Golang 1.15.x, that is cool as well. 93 | 94 | With this setup, you can build a topology like this: 95 | ``` 96 | +---------------------------------------------------+ 97 | | | 98 | | | 99 | DeVeloper 1 local laptop | | 100 | +------------------------+ | Container 1 | 101 | |* VSCode IDE | | +----------------------------+ | 102 | |* Remote SSH extension | SSH Connection | | * Ubuntu | | 103 | | +----------------------------------------------> | * Docker | | 104 | | | | | * Kubernetes +------------>Internet 105 | | | | | * Golang/Python/etc | | 106 | +------------------------+ | | * SSH | | 107 | | | | | 108 | | +----------------------------+ | 109 | | | 110 | | Container 2 | 111 | DeVeloper 2 local laptop | +----------------------------+ | 112 | +------------------------+ | | * Ubuntu | | 113 | | * VSCode IDE | SSH Connection | | * Docker +------------>Internet 114 | | * Remote SSH extension +----------------------------------------------> | * Kubernetes KinD | | 115 | | | | | * Golang/Python/etc | | 116 | +------------------------+ | | * SSH | | 117 | | +----------------------------+ | 118 | | | 119 | | | 120 | | | 121 | | | 122 | | Host Ubuntu system | 123 | | (AWS/EC2, GCP, Azure) | 124 | +---------------------------------------------------+ 125 | 126 | ``` 127 | * The developers runs VSCode locally on their laptops 128 | * They use their internet connection to SSH to a remote server 129 | * The remote server has a fully built and working environment with everything they need 130 | 131 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Apache License 2 | Version 2.0, January 2004 3 | http://www.apache.org/licenses/ 4 | 5 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 6 | 7 | 1. Definitions. 8 | 9 | "License" shall mean the terms and conditions for use, reproduction, 10 | and distribution as defined by Sections 1 through 9 of this document. 11 | 12 | "Licensor" shall mean the copyright owner or entity authorized by 13 | the copyright owner that is granting the License. 14 | 15 | "Legal Entity" shall mean the union of the acting entity and all 16 | other entities that control, are controlled by, or are under common 17 | control with that entity. For the purposes of this definition, 18 | "control" means (i) the power, direct or indirect, to cause the 19 | direction or management of such entity, whether by contract or 20 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 21 | outstanding shares, or (iii) beneficial ownership of such entity. 22 | 23 | "You" (or "Your") shall mean an individual or Legal Entity 24 | exercising permissions granted by this License. 25 | 26 | "Source" form shall mean the preferred form for making modifications, 27 | including but not limited to software source code, documentation 28 | source, and configuration files. 29 | 30 | "Object" form shall mean any form resulting from mechanical 31 | transformation or translation of a Source form, including but 32 | not limited to compiled object code, generated documentation, 33 | and conversions to other media types. 34 | 35 | "Work" shall mean the work of authorship, whether in Source or 36 | Object form, made available under the License, as indicated by a 37 | copyright notice that is included in or attached to the work 38 | (an example is provided in the Appendix below). 39 | 40 | "Derivative Works" shall mean any work, whether in Source or Object 41 | form, that is based on (or derived from) the Work and for which the 42 | editorial revisions, annotations, elaborations, or other modifications 43 | represent, as a whole, an original work of authorship. For the purposes 44 | of this License, Derivative Works shall not include works that remain 45 | separable from, or merely link (or bind by name) to the interfaces of, 46 | the Work and Derivative Works thereof. 47 | 48 | "Contribution" shall mean any work of authorship, including 49 | the original version of the Work and any modifications or additions 50 | to that Work or Derivative Works thereof, that is intentionally 51 | submitted to Licensor for inclusion in the Work by the copyright owner 52 | or by an individual or Legal Entity authorized to submit on behalf of 53 | the copyright owner. For the purposes of this definition, "submitted" 54 | means any form of electronic, verbal, or written communication sent 55 | to the Licensor or its representatives, including but not limited to 56 | communication on electronic mailing lists, source code control systems, 57 | and issue tracking systems that are managed by, or on behalf of, the 58 | Licensor for the purpose of discussing and improving the Work, but 59 | excluding communication that is conspicuously marked or otherwise 60 | designated in writing by the copyright owner as "Not a Contribution." 61 | 62 | "Contributor" shall mean Licensor and any individual or Legal Entity 63 | on behalf of whom a Contribution has been received by Licensor and 64 | subsequently incorporated within the Work. 65 | 66 | 2. Grant of Copyright License. Subject to the terms and conditions of 67 | this License, each Contributor hereby grants to You a perpetual, 68 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 69 | copyright license to reproduce, prepare Derivative Works of, 70 | publicly display, publicly perform, sublicense, and distribute the 71 | Work and such Derivative Works in Source or Object form. 72 | 73 | 3. Grant of Patent License. Subject to the terms and conditions of 74 | this License, each Contributor hereby grants to You a perpetual, 75 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 76 | (except as stated in this section) patent license to make, have made, 77 | use, offer to sell, sell, import, and otherwise transfer the Work, 78 | where such license applies only to those patent claims licensable 79 | by such Contributor that are necessarily infringed by their 80 | Contribution(s) alone or by combination of their Contribution(s) 81 | with the Work to which such Contribution(s) was submitted. If You 82 | institute patent litigation against any entity (including a 83 | cross-claim or counterclaim in a lawsuit) alleging that the Work 84 | or a Contribution incorporated within the Work constitutes direct 85 | or contributory patent infringement, then any patent licenses 86 | granted to You under this License for that Work shall terminate 87 | as of the date such litigation is filed. 88 | 89 | 4. Redistribution. You may reproduce and distribute copies of the 90 | Work or Derivative Works thereof in any medium, with or without 91 | modifications, and in Source or Object form, provided that You 92 | meet the following conditions: 93 | 94 | (a) You must give any other recipients of the Work or 95 | Derivative Works a copy of this License; and 96 | 97 | (b) You must cause any modified files to carry prominent notices 98 | stating that You changed the files; and 99 | 100 | (c) You must retain, in the Source form of any Derivative Works 101 | that You distribute, all copyright, patent, trademark, and 102 | attribution notices from the Source form of the Work, 103 | excluding those notices that do not pertain to any part of 104 | the Derivative Works; and 105 | 106 | (d) If the Work includes a "NOTICE" text file as part of its 107 | distribution, then any Derivative Works that You distribute must 108 | include a readable copy of the attribution notices contained 109 | within such NOTICE file, excluding those notices that do not 110 | pertain to any part of the Derivative Works, in at least one 111 | of the following places: within a NOTICE text file distributed 112 | as part of the Derivative Works; within the Source form or 113 | documentation, if provided along with the Derivative Works; or, 114 | within a display generated by the Derivative Works, if and 115 | wherever such third-party notices normally appear. The contents 116 | of the NOTICE file are for informational purposes only and 117 | do not modify the License. You may add Your own attribution 118 | notices within Derivative Works that You distribute, alongside 119 | or as an addendum to the NOTICE text from the Work, provided 120 | that such additional attribution notices cannot be construed 121 | as modifying the License. 122 | 123 | You may add Your own copyright statement to Your modifications and 124 | may provide additional or different license terms and conditions 125 | for use, reproduction, or distribution of Your modifications, or 126 | for any such Derivative Works as a whole, provided Your use, 127 | reproduction, and distribution of the Work otherwise complies with 128 | the conditions stated in this License. 129 | 130 | 5. Submission of Contributions. Unless You explicitly state otherwise, 131 | any Contribution intentionally submitted for inclusion in the Work 132 | by You to the Licensor shall be under the terms and conditions of 133 | this License, without any additional terms or conditions. 134 | Notwithstanding the above, nothing herein shall supersede or modify 135 | the terms of any separate license agreement you may have executed 136 | with Licensor regarding such Contributions. 137 | 138 | 6. Trademarks. This License does not grant permission to use the trade 139 | names, trademarks, service marks, or product names of the Licensor, 140 | except as required for reasonable and customary use in describing the 141 | origin of the Work and reproducing the content of the NOTICE file. 142 | 143 | 7. Disclaimer of Warranty. Unless required by applicable law or 144 | agreed to in writing, Licensor provides the Work (and each 145 | Contributor provides its Contributions) on an "AS IS" BASIS, 146 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 147 | implied, including, without limitation, any warranties or conditions 148 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 149 | PARTICULAR PURPOSE. You are solely responsible for determining the 150 | appropriateness of using or redistributing the Work and assume any 151 | risks associated with Your exercise of permissions under this License. 152 | 153 | 8. Limitation of Liability. In no event and under no legal theory, 154 | whether in tort (including negligence), contract, or otherwise, 155 | unless required by applicable law (such as deliberate and grossly 156 | negligent acts) or agreed to in writing, shall any Contributor be 157 | liable to You for damages, including any direct, indirect, special, 158 | incidental, or consequential damages of any character arising as a 159 | result of this License or out of the use or inability to use the 160 | Work (including but not limited to damages for loss of goodwill, 161 | work stoppage, computer failure or malfunction, or any and all 162 | other commercial damages or losses), even if such Contributor 163 | has been advised of the possibility of such damages. 164 | 165 | 9. Accepting Warranty or Additional Liability. While redistributing 166 | the Work or Derivative Works thereof, You may choose to offer, 167 | and charge a fee for, acceptance of support, warranty, indemnity, 168 | or other liability obligations and/or rights consistent with this 169 | License. However, in accepting such obligations, You may act only 170 | on Your own behalf and on Your sole responsibility, not on behalf 171 | of any other Contributor, and only if You agree to indemnify, 172 | defend, and hold each Contributor harmless for any liability 173 | incurred by, or claims asserted against, such Contributor by reason 174 | of your accepting any such warranty or additional liability. 175 | 176 | END OF TERMS AND CONDITIONS 177 | 178 | APPENDIX: How to apply the Apache License to your work. 179 | 180 | To apply the Apache License to your work, attach the following 181 | boilerplate notice, with the fields enclosed by brackets "[]" 182 | replaced with your own identifying information. (Don't include 183 | the brackets!) The text should be enclosed in the appropriate 184 | comment syntax for the file format. We also recommend that a 185 | file or class name and description of purpose be included on the 186 | same "printed page" as the copyright notice for easier 187 | identification within third-party archives. 188 | 189 | Copyright [yyyy] [name of copyright owner] 190 | 191 | Licensed under the Apache License, Version 2.0 (the "License"); 192 | you may not use this file except in compliance with the License. 193 | You may obtain a copy of the License at 194 | 195 | http://www.apache.org/licenses/LICENSE-2.0 196 | 197 | Unless required by applicable law or agreed to in writing, software 198 | distributed under the License is distributed on an "AS IS" BASIS, 199 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 200 | See the License for the specific language governing permissions and 201 | limitations under the License. 202 | --------------------------------------------------------------------------------