zoukankan      html  css  js  c++  java
  • OpenShift实战(二):OpenShift节点扩容

    1、新增节点信息

      增加节点如下,请将xxx改为自己的域名

    node6.xxx.net

    Node

    192.168.8.90

    8G

    20G/60G

    4C

    node7.xxx.net

    Node

    192.168.8.91

    8G

    20G/60G

    4C

    2、基本配置

      关闭Firewalld

    [root@node6 ~]# systemctl stop firewalld
    [root@node6 ~]# systemctl disabled firewalld
    Unknown operation 'disabled'.
    [root@node6 ~]# systemctl disable firewalld
    Removed symlink /etc/systemd/system/multi-user.target.wants/firewalld.service.
    Removed symlink /etc/systemd/system/dbus-org.fedoraproject.FirewallD1.service.

      更改所有节点hosts

    192.168.10.110 master1.xxx.net
    192.168.10.112 node1.xxx.net
    192.168.10.113 node2.xxx.net
    192.168.10.116 node3.xxx.net
    192.168.10.114 node4.xxx.net
    192.168.10.117 node5.xxx.net
    192.168.10.109 etcd1.xxx.net
    192.168.10.111 etcd2.xxx.net
    192.168.10.115 etcd3.xxx.net
    192.168.8.90 node6.xxx.net
    192.168.8.91 node7.xxx.net

      Master1节点SSH互信

    [root@master1 ~]# ssh-keygen -t rsa
    Generating public/private rsa key pair.
    Enter file in which to save the key (/root/.ssh/id_rsa): 
    Created directory '/root/.ssh'.
    Enter passphrase (empty for no passphrase): 
    Enter same passphrase again: 
    Your identification has been saved in /root/.ssh/id_rsa.
    Your public key has been saved in /root/.ssh/id_rsa.pub.
    The key fingerprint is:
    SHA256:yFOKV/QRdQoxQ12uW8v0UWmpLcrxDQo8VNyVEuRWHlE root@master1.xxx.net
    The key's randomart image is:
    +---[RSA 2048]----+
    |        ..X*++==E|
    |       . ..*o*o.+|
    |        o.. .oo=.|
    |     o =o   ..+ .|
    |    . * S+ ..+oo |
    |     . .  + ==+o.|
    |           +..o..|
    |                 |
    |                 |
    +----[SHA256]-----+
    
    for i in node6.xxx.net node7.xxx.net;do ssh-copy-id -i ~/.ssh/id_rsa.pub $i;done

      所有节点更改时区并同步时间

    ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
    ntpdate time.windows.com

      所有节点安装基本环境

    yum install wget git net-tools bind-utils iptables-services bridge-utils bash-completion kexec-tools sos psacct vim -y

      # 剩余步骤与之前一致,参考上一篇文档

      master1更改/etc/ansible/hosts

    # Create an OSEv3 group that contains the masters, nodes, and etcd groups
    [OSEv3:children]
    masters
    nodes
    etcd
    new_nodes
    #lb
    # Set variables common for all OSEv3 hosts
    [OSEv3:vars]
    # SSH user, this user should allow ssh based auth without requiring a password
    ansible_ssh_user=root
    ansible_become=yes
    debug_level=2
    openshift_deployment_type=origin
    # If ansible_ssh_user is not root, ansible_become must be set to true
    #ansible_become=true
    openshift_repos_enable_testing=true
    openshift_enable_service_catalog=false
    template_service_broker_install=false
    # uncomment the following to enable htpasswd authentication; defaults to DenyAllPasswordIdentityProvider
    openshift_master_identity_providers=[{'name': 'htpasswd_auth', 'login': 'true', 'challenge': 'true', 'kind': 'HTPasswdPasswordIdentityProvider', 'filename': '/etc/origin/master/htpasswd'}]
    openshift_disable_check=disk_availability,docker_storage,memory_availability,docker_image_availability,package_version
    # config for metrics
    openshift_release=3.6.1
    openshift_metrics_install_metrics=true
    openshift_metrics_cassandra_storage_type=emptydir
    openshift_metrics_hawkular_hostname=metrics.xxx.net
    openshift_clock_enabled=true
    #openshift_master_cluster_method=native
    #openshift_master_cluster_hostname=openshift.xxx.net
    #openshift_master_cluster_public_hostname=openshift.xxx.net
    #openshift_node_kubelet_args={'pods-per-core': ['10'], 'max-pods': ['250'], 'image-gc-high-threshold': ['90'], 'image-gc-low-threshold': ['80']}
    # host group for masters
    [masters]
    master1.xxx.net
    #master2.xxx.net
    
    # host group for lb
    #[lb]
    #lb.xxx.net
    
    # host group for etcd
    [etcd]
    etcd1.xxx.net
    etcd2.xxx.net
    etcd3.xxx.net
    # host group for nodes, includes region info
    [nodes]
    master1.xxx.net
    #master2.xxx.net
    node1.xxx.net openshift_node_labels="{'region': 'infra', 'zone': 'default'}"
    node2.xxx.net openshift_node_labels="{'region': 'infra', 'zone': 'default'}"
    node3.xxx.net openshift_node_labels="{'region': 'infra', 'zone': 'default'}"
    node4.xxx.net
    node5.xxx.net 
    #
    [new_nodes]
    node6.xxx.net openshift_node_labels="{'region': 'subnet8', 'zone': 'default'}"
    node7.xxx.net openshift_node_labels="{'region': 'subnet8', 'zone': 'default'}"

    3、安装 

      执行安装:

    ansible-playbook -i /etc/ansible/hosts /usr/share/ansible/openshift-ansible/playbooks/byo/openshift-node/scaleup.yml

      安装完成后,新加节点修改docker配置/etc/sysconfig/docker

    OPTIONS=' --selinux-enabled  --log-driver=journald --registry-mirror=https://docker.mirrors.ustc.edu.cn --insecure-registry=172.30.0.0/16 --insecure-registry 192.168.10.110:5000'

    4、其他组件

      其他组件如etcd、master节点扩容类似,参考文档:https://docs.openshift.org/3.6/install_config/adding_hosts_to_existing_cluster.html

  • 相关阅读:
    [HNOI2008] [BZOJ1008] 越狱|组合数学
    (转)位运算简介及使用技巧
    AW297 赤壁之战(数据结构优化DP)
    AW280 陪审团
    AW288 休息时间
    AW281 硬币
    AW383 观光
    AW366 看牛 (欧拉回路)
    AW365 圆桌骑士
    AW363 B城
  • 原文地址:https://www.cnblogs.com/dukuan/p/8732613.html
Copyright © 2011-2022 走看看