Skip to content

Instantly share code, notes, and snippets.

View davistran86's full-sized avatar

davistran86

View GitHub Profile
@davistran86
davistran86 / install_kubernetes_using_kubeadm
Last active August 10, 2017 04:40
Install kubernetes on Ubuntu 16.0 using kubeadm
#1. Edit /etc/hosts file. Do this on all Nodes (including master).
nano /etc/hosts
#Add the following
#<master_ip> <master_hostname>
#<node_ip> <node_name>
#Eg.
192.168.121.10 k8s_master
192.168.121.11 k8s_node1
192.168.121.12 k8s_node2
@davistran86
davistran86 / install_kubernetes_on_CentOS
Last active August 14, 2017 01:47
Install K8s on CentOS
===============================
#0. Hosts in cluster
===============================
#yum install -y net-tools nano wget
#192.168.70.141 k8s-master
#192.168.70.142 k8s-node
#Edit hosts file on all hosts (master,node)
cat <<EOF >> /etc/hosts
@davistran86
davistran86 / install_kubernetes_1.7.3_on_CentOS
Last active August 12, 2017 15:00
Install k8s 1.7.3 on CentOS
===============================
#INSTALL LATEST VERSION 1.7.3
===============================
cat <<EOF > /etc/yum.repos.d/virt7-container-common-candidate.repo
[virt7-container-common-candidate]
name=virt7-container-common-candidate
baseurl=http://cbs.centos.org/repos/virt7-container-common-candidate/x86_64/os/
enabled=0
gpgcheck=0
# See CentOS-extras.repo - change that first, then make this match.
docker run \
-d \
--rm \
-p 2379:2379 \
-p 2380:2380 \
--name etcd-v3.2 \
--volume=/tmp/etcd-data:/etcd-data \
gcr.io/etcd-development/etcd:latest \
/usr/local/bin/etcd \
--name my-etcd-1 \
cat > /tmp/my-etcd-1.service <<EOF
[Unit]
Description=etcd
Documentation=https://github.com/coreos/etcd
Conflicts=etcd.service
Conflicts=etcd2.service
[Service]
Type=notify
Restart=always
#in this lab, I use 3 computer:
- deploy: any pc in network running ubuntu, centos, even my laptop vm
- k8s-master : 192.168.70.141
- k8s-node1: 192.168.70.142
#do on deploy, master, node1
nano /etc/hosts
192.168.70.141 k8s-master
192.168.70.142 k8s-node1
192.168.70.94 kubernetes-master
sudo apt-get remove openssh-server
sudo apt-get install openssh-server
sudo nano /etc/ssh/sshd_config
#and disallow root login by setting PermitRootLogin no
#Then add a line beneath it that says:
AllowUsers yourusername
#and make sure PasswordAuthentication is set to yes if you want to login using a password.
echo "LS_COLORS=\"ow=01;36;40\" && export LS_COLORS" >> ~/.bashrc
Test env:
192.168.70.141 k8s-master
192.168.70.142 k8s-node1
#Add hosts file to all nodes (master,node)
cat <<EOF >> /etc/hosts
192.168.70.141 k8s-master
192.168.70.142 k8s-node1
EOF
[OSEv3:children]
masters
nodes
etcd
[OSEv3:vars]
# -- Ansible Configuration -----
ansible_ssh_user=root