Open NfreerCom opened 1 year ago
helm upgrade --namespace default my-ghost my-repo/ghost \ --set service.type=LoadBalancer,ghostHost=ghost,ghostPassword=!!Inhaint1,mysql.auth.rootPassword=!!Inhaint1,mysql.auth.password=!!Inhaint1
helm upgrade --namespace default my-release my-repo/ghost \ --set service.type=LoadBalancer,ghostHost=$APP_HOST,ghostPassword=$GHOST_PASSWORD,mysql.auth.rootPassword=$MYSQL_ROOT_PASSWORD,mysql.auth.password=$MYSQL_PASSWORD
192.168.0.25 k8s-master 192.168.0.26 k8s-worker1 192.168.0.27 k8s-worker2
[all]
[kube_control_plane]
[etcd]
[kube_node]
[calico_rr]
[k8s_cluster:children] kube_control_plane kube_node calico_rr
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQCSacYL3v50CPUQ3lvkSduds9WV8eii5H1i1vNRBHmJFDu1YMYa4sL5ON9QAv6aKZby1H19aHrYioo1+IFl37/Dr9n0tJ3nO4WzFh9bKonAu1hxkTbN8astHCvbbGd9vGTOXDDtc/fISe+Q9+COYEtgbNmYCX/BRbsawhtigo2m3YQiZE345HGrnL1Y1XFSF7tuXrjBbYdlhFDkztHW4vXt9oIMgHIotfXD2ZM8+hT5UrJZvhVYy51WyOOHCoV0O0fkEkAu15NqReBKDswP1fFwvbHij0jTxgeRnGxycB1M9Cax9t85CEZPJq1FGym+5NaBxruuLQ/CFzHi3lnS6O3nEZjlEnVyP7lcVJoYMCeQc392TJdeZM3ExYDIvblp9/Ckg29TS6x/V86DNl/Jv6FvkRLyVgvLXDOwxKUlY4icl2O1NO90M8irWKiAouQ0Mti0eA5/VYYkNaT8k+pf/YRU+TSeKRqyEuWaPAzClEMTwx9SmV2SRLtynigMIb3ag/s= master@k8s-master
sudo dnf config-manager --add-repo=https://download.docker.com/linux/centos/docker-ce.repo
sudo dnf install -y docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
sudo systemctl start docker && sudo systemctl enable docker && sudo systemctl status docker
sudo swapoff -a && sed -i '/swap/s/^/#/' /etc/fstab
%s//
sudo cat < /etc/sysctl.d/k8s.conf net.bridge.bridge-nf-call-ip6tables = 1 net.bridge.bridge-nf-call-iptables = 1 EOF
sudo chmod +w /etc/sudoers && echo 'admin ALL=NOPASSWD: ALL' | sudo tee -a /etc/sudoers && sudo chmod -w /etc/sudoers && sudo dnf -y install git sudo chmod +w /etc/sudoers && echo 'adm ALL=NOPASSWD: ALL' | sudo tee -a /etc/sudoers && sudo chmod -w /etc/sudoers && sudo dnf -y install git sudo chmod +w /etc/sudoers && echo 'worker2 ALL=NOPASSWD: ALL' | sudo tee -a /etc/sudoers && sudo chmod -w /etc/sudoers && sudo dnf -y install git
sudo vim /etc/hosts
127.0.0.1 nfreer.iptime.org 192.168.0.17 k8s-master 192.168.0.18 k8s-worker1 192.168.0.19 k8s-worker2
git clone https://github.com/kubernetes-sigs/kubespray && cd kubespray && cp -rfp inventory/sample inventory/mycluster
sudo dnf -y install python3-pip && sudo swapoff -a && sudo sed -i '/ swap / s/^(.*)$/#\1/g' /etc/fstab
sudo setenforce 0 & sudo sed -i 's/^SELINUX=enforcing$/SELINUX=permissive/' /etc/selinux/config && sudo sysctl -w net.ipv4.ip_forward=1
export PATH="/usr/local/bin:$PATH" && source ~/.bash_profile && echo $PATH
sudo pip3 install -r requirements.txt
declare -a IPS=(192.168.0.28 192.168.0.29 192.168.0.30) CONFIG_FILE=inventory/mycluster/hosts.yaml python3 contrib/inventory_builder/inventory.py ${IPS[@]}
vim inventory/mycluster/inventory.ini
ansible all -i inventory/mycluster/inventory.ini -m ping
echo "admin ALL=(ALL) NOPASSWD:ALL" | sudo tee /etc/sudoers.d/admin
< 서버공통>
sudo swapoff -a
sudo sysctl -w net.ipv4.ip_forward=1 && cat /proc/sys/net/ipv4/ip_forward
sudo vi /etc/hosts 192.168.0.28 master 192.168.0.29 worker1 192.168.0.30 worker2
< master> sudo dnf install -y epel-release && sudo dnf update -y && sudo dnf install -y ansible && sudo dnf install -y python3 && sudo dnf install -y python3-pip
ssh-keygen -t rsa
ssh-copy-id node1 && ssh-copy-id node2 && ssh-copy-id node3
ansible-playbook -i inventory/mycluster/hosts.yaml --become --become-user=root cluster.yml
sudo dnf config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo sudo dnf -y install docker-ce docker-ce-cli containerd.io docker-compose-plugin
127.0.0.1 localhost localhost.localdomain 192.168.0.28 master 192.168.0.29 worker1 192.168.0.30 worker2
hostnamectl set-hostname master1 hostnamectl set-hostname worker1 hostnamectl set-hostname worker2
sudo echo "192.168.0.28 master1" >> /etc/hosts && sudo echo "192.168.0.29 worker1" >> /etc/hosts && sudo echo "192.168.0.30 worker2" >> /etc/hosts
helm upgrade --namespace default my-ghost my-repo/ghost \ --set service.type=LoadBalancer,ghostHost=ghost,ghostPassword=!!Inhaint1,mysql.auth.rootPassword=!!Inhaint1,mysql.auth.password=!!Inhaint1
helm upgrade --namespace default my-release my-repo/ghost \ --set service.type=LoadBalancer,ghostHost=$APP_HOST,ghostPassword=$GHOST_PASSWORD,mysql.auth.rootPassword=$MYSQL_ROOT_PASSWORD,mysql.auth.password=$MYSQL_PASSWORD
192.168.0.25 k8s-master 192.168.0.26 k8s-worker1 192.168.0.27 k8s-worker2
Configure 'ip' variable to bind kubernetes services on a
different ip than the default iface
We should set etcd_member_name for etcd cluster. The node that is not a etcd member do not need to set the value, or can set the empty string value.
[all]
node1 ansible_host=95.54.0.12 # ip=10.3.0.1 etcd_member_name=etcd1
node2 ansible_host=95.54.0.13 # ip=10.3.0.2 etcd_member_name=etcd2
node3 ansible_host=95.54.0.14 # ip=10.3.0.3 etcd_member_name=etcd3
node4 ansible_host=95.54.0.15 # ip=10.3.0.4 etcd_member_name=etcd4
node5 ansible_host=95.54.0.16 # ip=10.3.0.5 etcd_member_name=etcd5
node6 ansible_host=95.54.0.17 # ip=10.3.0.6 etcd_member_name=etcd6
configure a bastion host if your nodes are not directly reachable
[bastion]
bastion ansible_host=x.x.x.x ansible_user=some_user
[kube_control_plane]
node1
node2
node3
[etcd]
node1
node2
node3
[kube_node]
node2
node3
node4
node5
node6
[calico_rr]
[k8s_cluster:children] kube_control_plane kube_node calico_rr
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQCSacYL3v50CPUQ3lvkSduds9WV8eii5H1i1vNRBHmJFDu1YMYa4sL5ON9QAv6aKZby1H19aHrYioo1+IFl37/Dr9n0tJ3nO4WzFh9bKonAu1hxkTbN8astHCvbbGd9vGTOXDDtc/fISe+Q9+COYEtgbNmYCX/BRbsawhtigo2m3YQiZE345HGrnL1Y1XFSF7tuXrjBbYdlhFDkztHW4vXt9oIMgHIotfXD2ZM8+hT5UrJZvhVYy51WyOOHCoV0O0fkEkAu15NqReBKDswP1fFwvbHij0jTxgeRnGxycB1M9Cax9t85CEZPJq1FGym+5NaBxruuLQ/CFzHi3lnS6O3nEZjlEnVyP7lcVJoYMCeQc392TJdeZM3ExYDIvblp9/Ckg29TS6x/V86DNl/Jv6FvkRLyVgvLXDOwxKUlY4icl2O1NO90M8irWKiAouQ0Mti0eA5/VYYkNaT8k+pf/YRU+TSeKRqyEuWaPAzClEMTwx9SmV2SRLtynigMIb3ag/s= master@k8s-master
sudo dnf config-manager --add-repo=https://download.docker.com/linux/centos/docker-ce.repo
sudo dnf install -y docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
sudo systemctl start docker && sudo systemctl enable docker && sudo systemctl status docker
sudo swapoff -a && sed -i '/swap/s/^/#/' /etc/fstab
%s//
sudo cat < /etc/sysctl.d/k8s.conf
net.bridge.bridge-nf-call-ip6tables = 1
net.bridge.bridge-nf-call-iptables = 1
EOF
sudo chmod +w /etc/sudoers && echo 'admin ALL=NOPASSWD: ALL' | sudo tee -a /etc/sudoers && sudo chmod -w /etc/sudoers && sudo dnf -y install git sudo chmod +w /etc/sudoers && echo 'adm ALL=NOPASSWD: ALL' | sudo tee -a /etc/sudoers && sudo chmod -w /etc/sudoers && sudo dnf -y install git sudo chmod +w /etc/sudoers && echo 'worker2 ALL=NOPASSWD: ALL' | sudo tee -a /etc/sudoers && sudo chmod -w /etc/sudoers && sudo dnf -y install git
sudo vim /etc/hosts
127.0.0.1 nfreer.iptime.org 192.168.0.17 k8s-master 192.168.0.18 k8s-worker1 192.168.0.19 k8s-worker2
git clone https://github.com/kubernetes-sigs/kubespray && cd kubespray && cp -rfp inventory/sample inventory/mycluster
sudo dnf -y install python3-pip && sudo swapoff -a && sudo sed -i '/ swap / s/^(.*)$/#\1/g' /etc/fstab
sudo setenforce 0 & sudo sed -i 's/^SELINUX=enforcing$/SELINUX=permissive/' /etc/selinux/config && sudo sysctl -w net.ipv4.ip_forward=1
export PATH="/usr/local/bin:$PATH" && source ~/.bash_profile && echo $PATH
sudo pip3 install -r requirements.txt
declare -a IPS=(192.168.0.28 192.168.0.29 192.168.0.30) CONFIG_FILE=inventory/mycluster/hosts.yaml python3 contrib/inventory_builder/inventory.py ${IPS[@]}
vim inventory/mycluster/inventory.ini
ansible all -i inventory/mycluster/inventory.ini -m ping
echo "admin ALL=(ALL) NOPASSWD:ALL" | sudo tee /etc/sudoers.d/admin
< 서버공통>
sudo swapoff -a
sudo sysctl -w net.ipv4.ip_forward=1 && cat /proc/sys/net/ipv4/ip_forward
sudo vi /etc/hosts 192.168.0.28 master 192.168.0.29 worker1 192.168.0.30 worker2
< master> sudo dnf install -y epel-release && sudo dnf update -y && sudo dnf install -y ansible && sudo dnf install -y python3 && sudo dnf install -y python3-pip
ssh-keygen -t rsa
ssh-copy-id node1 && ssh-copy-id node2 && ssh-copy-id node3
ansible-playbook -i inventory/mycluster/hosts.yaml --become --become-user=root cluster.yml
sudo dnf config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo sudo dnf -y install docker-ce docker-ce-cli containerd.io docker-compose-plugin
127.0.0.1 localhost localhost.localdomain 192.168.0.28 master 192.168.0.29 worker1 192.168.0.30 worker2
hostnamectl set-hostname master1 hostnamectl set-hostname worker1 hostnamectl set-hostname worker2
sudo echo "192.168.0.28 master1" >> /etc/hosts && sudo echo "192.168.0.29 worker1" >> /etc/hosts && sudo echo "192.168.0.30 worker2" >> /etc/hosts