Table of Content

create new vm in EC2

ssh to ec2 vm from local laptop,

$ ssh -i "~/.ssh/dreamcloud.pem" ec2-user@ec2-xxxx.ca-central-1.compute.amazonaws.com

       __|  __|_  )
       _|  (     /   Amazon Linux AMI
      ___|\___|___|

https://aws.amazon.com/amazon-linux-ami/2017.09-release-notes/
1 package(s) needed for security, out of 6 available
Run "sudo yum update" to apply all updates.
[ec2-user@ip  ~]$

[ec2-user@ip  ~]$ uname -a
Linux ip  4.9.62-21.56.amzn1.x86_64 #1 SMP Thu Nov 16 05:37:08 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux
[ec2-user@ip  ~]$ df -h
Filesystem      Size  Used Avail Use% Mounted on
devtmpfs        488M   56K  488M   1% /dev
tmpfs           497M     0  497M   0% /dev/shm
/dev/xvda1      7.8G 1023M  6.7G  14% /

install docker

sudo yum update -y
sudo yum install -y docker
sudo service docker start
[ec2-user@ip  ~]$ sudo service docker start
Starting cgconfig service:                                 [  OK  ]
Starting docker:        .                                  [  OK  ]
sudo usermod -a -G docker ec2-user
relogin as ec2-user
docker info

install minikube

I used my script to quickly install minikube single node cluster on EC2,

[ec2-user@ip ~]$ bash ./minikube-none.sh
sudo: minikube: command not found

usually we put minikube/kubectl/localkube at /usr/local/bin, but /usr/local/bin is not in sudo secure_path.

so update secure_path in sudo config,

$ sudo visudo
Defaults secure_path = /sbin:/bin:/usr/sbin:/usr/bin:/usr/local/bin

re-run minikube-none.sh again,

minikube start ...
Starting local Kubernetes v1.8.0 cluster...
Starting VM...
Getting VM IP address...
Moving files into cluster...
Downloading localkube binary
 148.25 MB / 148.25 MB [============================================] 100.00% 0s
 65 B / 65 B [======================================================] 100.00% 0s
Setting up certs...
Connecting to cluster...
Setting up kubeconfig...
Starting cluster components...
Kubectl is now configured to use the cluster.
===================
WARNING: IT IS RECOMMENDED NOT TO RUN THE NONE DRIVER ON PERSONAL WORKSTATIONS
        The 'none' driver will run an insecure kubernetes apiserver as root that may leave the host vulnerable to CSRF attacks

Loading cached images from config file.

verify minikube

[ec2-user@ip ~]$ minikube status
minikube: Running
cluster: Running
kubectl: Correctly Configured: pointing to minikube-vm at 127.0.0.1

[ec2-user@ip ~]$ kubectl get pods
No resources found.
[ec2-user@ip ~]$ kubectl get services
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
kubernetes ClusterIP 10.96.0.1 443/TCP 13m