This file contains hidden or 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
| #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 |
This file contains hidden or 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
| =============================== | |
| #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 |
This file contains hidden or 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
| =============================== | |
| #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. |
This file contains hidden or 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
| 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 \ |
This file contains hidden or 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
| 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 |
This file contains hidden or 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
| #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 |
This file contains hidden or 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
| 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. |
This file contains hidden or 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
| echo "LS_COLORS=\"ow=01;36;40\" && export LS_COLORS" >> ~/.bashrc |
This file contains hidden or 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
| 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 |
This file contains hidden or 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
| [OSEv3:children] | |
| masters | |
| nodes | |
| etcd | |
| [OSEv3:vars] | |
| # -- Ansible Configuration ----- | |
| ansible_ssh_user=root |
OlderNewer