Febrac8 + OpenShift + Kubernetes (3) Install OpenShift

Prepare OpenShift Ansible packages

Modify the Master configuration files.

  1. /root/openshift-ansible/roles/openshift_version/tasks/masters_and_nodes.yml:
    line 12~13:
  # block when
  when: 
  - not openshift_is_atomic | bool
  - not openshift_is_containerized | bool
  1. Prepare the host file for ansible
    Path: /etc/ansible/hosts
[OSEv3:children]
masters
nodes
etcd
lb
# Specify there will be GlusterFS nodes
glusterfs
glusterfs_registry

[OSEv3:vars]
ansible_user=root
ansible_ssh_user=root
openshift_deployment_type=origin
#openshift_docker_use_system_container=True
openshift_disable_check=docker_image_availability
containerized=true
openshift_release=3.9
openshift_image_tag=v3.9.0
openshift_pkg_version=-3.9.0
enable_excluders=false

# htpasswd auth
openshift_master_identity_providers=[{'name': 'htpasswd_auth', 'login': 'true', 'challenge': 'true', 'kind': 'HTPasswdPasswordIdentityProvider', 'filename': '/etc/origin/master/htpasswd'},{'name': 'my_ldap_provider', 'challenge': 'true', 'login': 'true', 'kind': 'LDAPPasswordIdentityProvider', 'attributes': {'id': ['dn'], 'email': ['mail'], 'name': ['cn'], 'preferredUsername': ['uid']}, 'bindDN': '', 'bindPassword': '', 'insecure': 'false', 'url': 'ldap://192.168.0.137:389/ou=Tech,dc=gemii,dc=cc?uid'}]
# Defining htpasswd users
openshift_master_htpasswd_users={'admin': '$apr1$0oyVx7VK$OFmO1wA2oUdY.7026TY380'}
# LDAP auth

openshift_storage_glusterfs_namespace=glusterfs 
openshift_storage_glusterfs_name=storage

openshift_hosted_registry_cert_expire_days=3650
openshift_ca_cert_expire_days=3650
openshift_node_cert_expire_days=3650
openshift_master_cert_expire_days=3650
etcd_ca_default_days=3650
os_firewall_use_firewalld=True

openshift_master_cluster_method=native
openshift_master_cluster_hostname=lb1.os.gemii.tech
openshift_master_cluster_public_hostname=oc.os.gemii.tech

#openshift_master_default_subdomain=os.gemii.tech

openshift_clock_enabled=true
# apply updated node defaults
openshift_node_kubelet_args={'pods-per-core': ['10'], 'max-pods': ['250'], 'image-gc-high-threshold': ['90'], 'image-gc-low-threshold': ['80']}

#openshift_logging_install_logging=true
# Configure loggingPublicURL in the master config for aggregate logging, defaults
# to kibana.{{ openshift_master_default_subdomain }}
#openshift_logging_kibana_hostname=logging.dev.gemii.cc
# Configure the number of elastic search nodes, unless you're using dynamic provisioning
# this value must be 1
#openshift_logging_es_cluster_size=3
# Configure the prefix and version for the component images
#openshift_logging_image_prefix=docker.io/openshift/origin-
#openshift_logging_image_version=v3.7.0
#openshift_http_proxy=http://192.168.0.127:8118/
#openshift_https_proxy=http://192.168.0.127:8118/
#openshift_no_proxy='localhost,127.0.0.1,180.169.188.90,hub.docker.gemii.cc,192.168.0.169'


openshift_hosted_registry_storage_kind=glusterfs
openshift_hosted_registry_replicas=3
openshift_hosted_registry_storage_volume_size=500Gi
openshift_generate_no_proxy_hosts=false

[masters]
oskm1.os.gemii.tech
oskm2.os.gemii.tech
oskm3.os.gemii.tech

[nodes]
# masters should be schedulable to run web console pods
oskm1.os.gemii.tech     openshift_schedulable=True 
oskm2.os.gemii.tech     openshift_schedulable=True 
oskm3.os.gemii.tech     openshift_schedulable=True 
oskw1.os.gemii.tech     openshift_node_labels="{'region': 'infra'}" openshift_schedulable=True
oskw2.os.gemii.tech     openshift_node_labels="{'region': 'infra'}" openshift_schedulable=True
oskw3.os.gemii.tech     openshift_node_labels="{'region': 'infra'}" openshift_schedulable=True
oskw4.os.gemii.tech     openshift_node_labels="{'region': 'primary'}" openshift_schedulable=True
oskw5.os.gemii.tech     openshift_node_labels="{'region': 'primary'}" openshift_schedulable=True
oskw6.os.gemii.tech     openshift_node_labels="{'region': 'primary'}" openshift_schedulable=True
oskw7.os.gemii.tech     openshift_node_labels="{'region': 'primary'}" openshift_schedulable=True
oskw8.os.gemii.tech     openshift_node_labels="{'region': 'primary'}" openshift_schedulable=True
oskw9.os.gemii.tech     openshift_node_labels="{'region': 'primary'}" openshift_schedulable=True

[etcd]
oskm1.os.gemii.tech
oskm2.os.gemii.tech
oskm3.os.gemii.tech

[lb]
lb1.os.gemii.tech

# Specify the glusterfs group, which contains the nodes of the external
# GlusterFS cluster. At a minimum, each node must have "glusterfs_hostname"
# and "glusterfs_devices" variables defined.
#
# The first variable indicates the hostname of the external GLusterFS node,
# and must be reachable by the external heketi service.
#
# The second variable is a list of block devices the node will have access to
# that are intended solely for use as GlusterFS storage. These block devices
# must be bare (e.g. have no data, not be marked as LVM PVs), and will be
# formatted.
[glusterfs]
oskw1.os.gemii.tech  glusterfs_devices='[ "/dev/sdc" ]'
oskw2.os.gemii.tech  glusterfs_devices='[ "/dev/sdc" ]'
oskw3.os.gemii.tech  glusterfs_devices='[ "/dev/sdc" ]'

[glusterfs_registry]
oskm1.os.gemii.tech  glusterfs_devices='[ "/dev/sdc" ]'
oskm2.os.gemii.tech  glusterfs_devices='[ "/dev/sdc" ]'
oskm3.os.gemii.tech  glusterfs_devices='[ "/dev/sdc" ]'

3 Install OpenShift

# cd ~
# ansible-playbook ./openshift-ansible/playbooks/prerequisites.yml 
# ansible-playbook ./openshift-ansible/playbooks/deploy_cluster.yml 

你可能感兴趣的:(Febrac8 + OpenShift + Kubernetes (3) Install OpenShift)