Created
June 8, 2018 21:34
-
-
Save andrewwippler/3f031536ef7d761792b8fce1fd967aef to your computer and use it in GitHub Desktop.
Single node kubernetes cluster on AWS (with ECR)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
apt-get update | |
apt-get upgrade -y | |
apt-get update && apt-get install -y apt-transport-https curl | |
curl -s https://packages.cloud.google.com/apt/doc/apt-key.gpg | apt-key add - | |
cat <<EOF >/etc/apt/sources.list.d/kubernetes.list | |
deb http://apt.kubernetes.io/ kubernetes-xenial main | |
EOF | |
apt-get update | |
apt-get install -y kubelet kubeadm kubectl docker.io | |
# set up config file | |
export EXTERNAL_IP=$(curl http://169.254.169.254/latest/meta-data/public-ipv4) | |
export INTERNAL_IP=$(curl http://169.254.169.254/latest/meta-data/local-ipv4) | |
cat <<EOF > kubeadm.conf | |
kind: MasterConfiguration | |
apiVersion: kubeadm.k8s.io/v1alpha1 | |
apiServerCertSANs: | |
- 10.96.0.1 | |
- ${EXTERNAL_IP} | |
- ${INTERNAL_IP} | |
kubernetesVersion: 1.10.3 | |
cloudProvider: aws | |
networking: | |
podSubnet: 10.244.0.0/16 | |
EOF | |
# use config file | |
kubeadm init --config=kubeadm.conf | |
# needed on CentOS, but added for good measure | |
cat <<EOF > /etc/sysctl.d/k8s.conf | |
net.bridge.bridge-nf-call-ip6tables = 1 | |
net.bridge.bridge-nf-call-iptables = 1 | |
EOF | |
sysctl --system | |
# make below commands work | |
mkdir -p $HOME/.kube | |
sudo cp -i /etc/kubernetes/admin.conf $HOME/.kube/config | |
sudo chown $(id -u):$(id -g) $HOME/.kube/config | |
#remove the taint | |
kubectl taint nodes --all node-role.kubernetes.io/master- | |
kubectl apply -f https://raw.githubusercontent.com/coreos/flannel/v0.9.1/Documentation/kube-flannel.yml |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment