Last active
January 17, 2023 22:01
-
-
Save davistran86/c472350697678b6e41d3da487fc7e52d to your computer and use it in GitHub Desktop.
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
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 | |
#Add epel-release (master,node) | |
yum install epel-release | |
#Install required packages (master,node) | |
#yum install -y ansible pyOpenSSL docker nano wget git net-tools bind-utils iptables-services bridge-utils bash-completion kexec-tools sos psacct | |
yum install -y ansible docker git net-tools nano wget pyOpenSSL | |
yum update | |
#Edit the /etc/sysconfig/docker file and add --insecure-registry 172.30.0.0/16 to the OPTIONS parameter. For example: | |
#OPTIONS='--selinux-enabled --insecure-registry 172.30.0.0/16' | |
sed -i '/OPTIONS=.*/c\OPTIONS="--selinux-enabled --insecure-registry 172.30.0.0/16"' /etc/sysconfig/docker | |
#NOTE: NEED TO CONFIG DOCKER STORAGE SETUP!!!!!!!! OTHERWISE POD CANNOT BE USED AS NO SPACE LEFT | |
#e.g. WARNING: Some health checks are reporting as unhealthy: [disk-space : Only 0.372 Gb free on (master)] | |
#Start docker service (master,node) | |
service docker start | |
#Reboot (master,node) | |
reboot | |
#clone openshift-ansible (master) | |
git clone https://github.com/openshift/openshift-ansible.git | |
#Edit /etc/ansible/hosts | |
#Offical Reference: https://github.com/openshift/openshift-ansible/blob/master/inventory/byo/hosts.ose.example | |
#Example Reference: https://github.com/jdob/daibo/blob/master/lab/ansible/inventory.erb | |
#My hosts: https://gist.github.com/davistran86/b3b6f3655ad0e1a86582f0ee0a40906c | |
nano /etc/ansible/hosts | |
#Create key for logon | |
#for not a root user, e.g. testuser, need to set passwordless sudo | |
ssh-keygen -t rsa -b 4096 -f openshift.key -P "" | |
ssh-copy-id -i openshift.key [email protected] | |
ssh-copy-id -i openshift.key [email protected] | |
#Run installer, use openshift-ansible/playbooks/byo/config.yml | |
ansible-playbook -i /etc/ansible/hosts openshift-ansible/playbooks/byo/config.yml --private-key=openshift.key -v | |
#To add user | |
htpasswd /etc/origin/master/htpasswd <username> | |
#To uninstall openshift | |
ansible-playbook [-i hosts] openshift-ansible/playbooks/adhoc/uninstall.yml |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment