zoukankan      html  css  js  c++  java
  • centos7.7 openshift 3.9 All_in_one 安装体验

    1- 环境说明

    os ip vcpu ram disk kernel
    centos7.7 mini 192.168.116.129 2 8G 120G 4.13

    2- 安装

    • 升级内核
    wget https://elrepo.org/linux/kernel/el7/x86_64/RPMS/kernel-lt-4.4.244-1.el7.elrepo.x86_64.rpm
    wget https://elrepo.org/linux/kernel/el7/x86_64/RPMS/kernel-lt-doc-4.4.244-1.el7.elrepo.noarch.rpm
    
    yum localinstall -y kernel-lt-*
    sed -i 'ssavedg' /etc/default/grub
    grub2-mkconfig -o /boot/grub2/grub.cfg
    
    • 内核参数优化
    systemctl enable rc-local
    chmod a+x /etc/rc.d/rc.local
    systemctl restart rc-local
    
    cat >> /etc/rc.local  << EOF
    modprobe ip_vs_rr
    modprobe br_netfilter
    EOF
    
    cat > /etc/modules-load.d/ipvs.conf << EOF
    ip_vs_rr
    br_netfilter
    EOF
    
    systemctl enable --now systemd-modules-load.service
    
    cat >/etc/sysctl.d/kubernetes.conf <<EOF
    net.bridge.bridge-nf-call-iptables=1
    net.bridge.bridge-nf-call-ip6tables=1
    net.ipv4.ip_forward=1
    net.ipv4.tcp_tw_recycle=0
    vm.swappiness=0
    vm.overcommit_memory=1
    vm.panic_on_oom=0
    fs.inotify.max_user_instances=8192
    fs.inotify.max_user_watches=1048576
    fs.file-max=52706963
    fs.nr_open=52706963
    net.ipv6.conf.all.disable_ipv6=1
    net.netfilter.nf_conntrack_max=2310720
    EOF
    
    sysctl -p /etc/sysctl.d/kubernetes.conf
    
    reboot
    
    • 安装docker-ce
    yum remove docker docker-common docker-selinux docker-engine -y  #如果你之前安装过 docker,请先删掉
    yum install -y yum-utils device-mapper-persistent-data lvm2 #安装一些依赖
    curl -o /etc/yum.repos.d/docker-ce.repo https://files-cdn.cnblogs.com/files/lemanlai/docker-ce.repo.sh
    yum clean all
    yum makecache fast
    
    yum -y install docker-ce
    systemctl enable docker
    mkdir -p /etc/docker
    cat << EOF > /etc/docker/daemon.json
    {"registry-mirrors": ["http://f1361db2.m.daocloud.io"],
    "insecure-registries":["172.30.0.0/16"]}
    EOF
    
    systemctl daemon-reload
    systemctl restart docker
    
    • 启动openshift
    ## 下载客户端命令
    wget https://github.com/openshift/origin/releases/download/v3.9.0/openshift-origin-client-tools-v3.9.0-191fece-linux-64bit.tar.gz
    
    tar -zxvf openshift-origin-client-tools-v3.9.0-191fece-linux-64bit.tar.gz
    
    mv openshift-origin-client-tools-v3.9.0-191fece-linux-64bit/oc /usr/local/bin/
    
    # 查看版本
    [root@ocp3 ~]# oc version
    oc v3.9.0+191fece
    kubernetes v1.9.1+a0ce1bc657
    features: Basic-Auth GSSAPI Kerberos SPNEGO
    
    # 启动参数
    [root@ocp3 ~]# oc cluster up --help
    Starts an OpenShift cluster using Docker containers, provisioning a registry, router, initial
    templates, and a default project.
    
    This command will attempt to use an existing connection to a Docker daemon. Before running the
    command, ensure that you can execute docker commands successfully (i.e. 'docker ps').
    
    Optionally, the command can create a new Docker machine for OpenShift using the VirtualBox driver
    when the --create-machine argument is specified. The machine will be named 'openshift' by default.
    To name the machine differently, use the --docker-machine=NAME argument. If the
    --docker-machine=NAME argument is specified, but --create-machine is not, the command will attempt
    to find an existing docker machine with that name and start it if it's not running.
    
    By default, the OpenShift cluster will be setup to use a routing suffix that ends in nip.io. This is
    to allow dynamic host names to be created for routes. An alternate routing suffix can be specified
    using the --routing-suffix flag.
    
    A public hostname can also be specified for the server with the --public-hostname flag.
    
    Usage:
      oc cluster up [options]
    
    Examples:
      # Start OpenShift on a new docker machine named 'openshift'
      oc cluster up --create-machine
    
      # Start OpenShift using a specific public host name
      oc cluster up --public-hostname=my.address.example.com
    
      # Start OpenShift and preserve data and config between restarts
      oc cluster up --host-data-dir=/mydata --use-existing-config
    
      # Use a different set of images
      oc cluster up --image="registry.example.com/origin" --version="v1.1"
    
      # Specify which set of image streams to use
      oc cluster up --image-streams=centos7
    
    Options:
          --create-machine=false: Create a Docker machine if one doesn't exist
          --docker-machine='': Specify the Docker machine to use
      -e, --env=[]: Specify a key-value pair for an environment variable to set on OpenShift container
          --forward-ports=false: Use Docker port-forwarding to communicate with origin container.
    Requires 'socat' locally.
          --host-config-dir='/var/lib/origin/openshift.local.config': Directory on Docker host for
    OpenShift configuration
          --host-data-dir='': Directory on Docker host for OpenShift data. If not specified, etcd data
    will not be persisted on the host.
          --host-pv-dir='/var/lib/origin/openshift.local.pv': Directory on host for OpenShift persistent
    volumes
          --host-volumes-dir='/var/lib/origin/openshift.local.volumes': Directory on Docker host for
    OpenShift volumes
          --http-proxy='': HTTP proxy to use for master and builds
          --https-proxy='': HTTPS proxy to use for master and builds
          --image='openshift/origin': Specify the images to use for OpenShift
          --image-streams='centos7': Specify which image streams to use, centos7|rhel7
          --logging=false: Install logging (experimental)
          --metrics=false: Install metrics (experimental)
          --no-proxy=[]: List of hosts or subnets for which a proxy should not be used
          --public-hostname='': Public hostname for OpenShift cluster
          --routing-suffix='': Default suffix for server routes
          --server-loglevel=0: Log level for OpenShift server
          --service-catalog=false: Install service catalog (experimental).
          --skip-registry-check=false: Skip Docker daemon registry check
          --use-existing-config=false: Use existing configuration if present
          --version='': Specify the tag for OpenShift images
    
    Use "oc options" for a list of global command-line options (applies to all commands).
    
    # 启动
    oc cluster up --host-data-dir="/opt" --public-hostname='192.168.116.129'
    
    # 启动
    mkdir -p /opt/ocp3.9/data    # openshift 数据
    
    oc cluster up  --public-hostname='192.168.116.129' --logging=true  --metrics=true --server-loglevel=0  --image-streams='centos7' --host-data-dir='/opt/ocp3.9/data'
    
    

    启动过程

    [root@ocp3 ~]#  oc cluster up  --public-hostname='192.168.116.129' --logging=true  --metrics=true --server-loglevel=0  --image-streams='centos7' --host-data-dir='/opt/ocp3.9/data'
    
    Pulling image openshift/origin:v3.9.0
    Pulled 1/4 layers, 26% complete
    Pulled 1/4 layers, 32% complete
    Pulled 1/4 layers, 38% complete
    Pulled 1/4 layers, 45% complete
    Pulled 1/4 layers, 51% complete
    Pulled 2/4 layers, 61% complete
    Pulled 2/4 layers, 66% complete
    Pulled 2/4 layers, 71% complete
    Pulled 3/4 layers, 81% complete
    Pulled 3/4 layers, 85% complete
    Pulled 3/4 layers, 89% complete
    Pulled 3/4 layers, 93% complete
    Pulled 3/4 layers, 97% complete
    Pulled 4/4 layers, 100% complete
    Extracting
    Image pull complete
    Using nsenter mounter for OpenShift volumes
    Using public hostname IP 192.168.116.129 as the host IP
    Using 192.168.116.129 as the server IP
    Starting OpenShift using openshift/origin:v3.9.0 ...
    OpenShift server started.
    
    The server is accessible via web console at:
        https://192.168.116.129:8443
    
    The metrics service is available at:
        https://hawkular-metrics-openshift-infra.192.168.116.129.nip.io/hawkular/metrics
    
    The kibana logging UI is available at:
        https://kibana-logging.192.168.116.129.nip.io
    
    You are logged in as:
        User:     developer
        Password: <any value>
    
    To login as administrator:
        oc login -u system:admin
    

    web登录用用户名和密码:

    • admin admin
    • developer developer
  • 相关阅读:
    [翻译角]Headline English: A Captain Should Be Pitch Perfect at a Multitude of Skills (ESLPOD Blog)
    CF735D Taxes 哥德巴赫猜想判定素数 进一步猜想
    CF735C 数论平衡树叶子节点的最大深度贪心斐波那契条件归一化
    萌新的旅行&hdu5681单调队列的应用前缀和线段树ST表倍增解法
    CF731C Socks并查集(森林),连边,贪心,森林遍历方式,动态开点释放内存
    玲珑杯1007-A 八进制大数加法(实现逻辑陷阱与题目套路)
    关于石子合并
    codeforces724-B. Batch Sort
    codeforces724-A. Checking the Calendar 日期题
    如何筛选人
  • 原文地址:https://www.cnblogs.com/lemanlai/p/14013478.html
Copyright © 2011-2022 走看看