2016年3月18日星期五

OpenShift_007:离线安装 OSE 3.1 之六:安装 OSE 3.1

环境:OS X EI Capitan 10.11.3 + Open Shift Enterprise 3.1

以下操作均在 Master 节点上执行

1. 为 Master、Node1、Node2 节点分别创建 subnet.json 脚本
(1)vim master-subnet.json
{
    "kind": "HostSubnet",
    "apiVersion": "v1",
    "metadata": {
        "name": "master.example.com",
        "selfLink": "/oapi/v1/hostsubnets/master.example.com"
    },
    "host": "master.example.com",
    "hostIP": "192.168.56.106",
    "subnet": "10.1.1.0/24"
}
(2)vim node1-subnet.json
{
    "kind": "HostSubnet",
    "apiVersion": "v1",
    "metadata": {
        "name": "node1.example.com",
        "selfLink": "/oapi/v1/hostsubnets/node1.example.com"
    },
    "host": "node1.example.com",
    "hostIP": "192.168.56.107",
    "subnet": "10.1.2.0/24"
}
(3)vim node2-subnet.json
{
    "kind": "HostSubnet",
    "apiVersion": "v1",
    "metadata": {
        "name": "node2.example.com",
        "selfLink": "/oapi/v1/hostsubnets/node2.example.com"
    },
    "host": "node2.example.com",
    "hostIP": "192.168.56.108",
    "subnet": "10.1.3.0/24"
}

2. 集群内机器的 ssh 互信
ssh-keygen;
for i in master.example.com node1.example.com node2.example.com;
do
ssh-copy-id $i;
done;

3. 安装 atomic-openshift-installer
atomic-openshift-installer install

交互输入输出如下:
Welcome to the OpenShift Enterprise 3 installation.

Please confirm that following prerequisites have been met:

* All systems where OpenShift will be installed are running Red Hat Enterprise
  Linux 7.
* All systems are properly subscribed to the required OpenShift Enterprise 3
  repositories.
* All systems have run docker-storage-setup (part of the Red Hat docker RPM).
* All systems have working DNS that resolves not only from the perspective of
  the installer but also from within the cluster.

When the process completes you will have a default configuration for Masters
and Nodes.  For ongoing environment maintenance it's recommended that the
official Ansible playbooks be used.

For more information on installation prerequisites please see:
https://docs.openshift.com/enterprise/latest/admin_guide/install/prerequisites.html

Are you ready to continue? [y/N]:y

This installation process will involve connecting to remote hosts via ssh.  Any
account may be used however if a non-root account is used it must have
passwordless sudo access.

User for ssh access [root]:


Which variant would you like to install?


(1) OpenShift Enterprise 3.1
(2) OpenShift Enterprise 3.0
(3) Atomic Enterprise Platform 3.1

Choose a variant from above:  [1]:

*** Host Configuration ***

You must now specify the hosts that will compose your OpenShift cluster.

Please enter an IP or hostname to connect to for each system in the cluster.
You will then be prompted to identify what role you would like this system to
serve in the cluster.

OpenShift Masters serve the API and web console and coordinate the jobs to run
across the environment.  If desired you can specify multiple Master systems for
an HA deployment, in which case you will be prompted to identify a *separate*
system to act as the load balancer for your cluster after all Masters and Nodes
are defined.

If only one Master is specified, an etcd instance embedded within the OpenShift
Master service will be used as the datastore.  This can be later replaced with a
separate etcd instance if desired.  If multiple Masters are specified, a
separate etcd cluster will be configured with each Master serving as a member.

Any Masters configured as part of this installation process will also be
configured as Nodes.  This is so that the Master will be able to proxy to Pods
from the API.  By default this Node will be unschedulable but this can be changed
after installation with 'oadm manage-node'.

OpenShift Nodes provide the runtime environments for containers.  They will
host the required services to be managed by the Master.

http://docs.openshift.com/enterprise/latest/architecture/infrastructure_components/kubernetes_infrastructure.html#master
http://docs.openshift.com/enterprise/latest/architecture/infrastructure_components/kubernetes_infrastructure.html#node

Enter hostname or IP address: master.example.com
Will this host be an OpenShift Master? [y/N]: y

*** Installation Summary ***

Hosts:
- master.example.com
  - OpenShift Master
  - OpenShift Node
  - Etcd (Embedded)

Total OpenShift Masters: 1
Total OpenShift Nodes: 1

NOTE: Add a total of 3 or more Masters to perform an HA installation.

Do you want to add additional hosts? [y/N]: y
Enter hostname or IP address: node1.example.com
Will this host be an OpenShift Master? [y/N]: n


*** Installation Summary ***

Hosts:
- master.example.com
  - OpenShift Master
  - OpenShift Node (Unscheduled)
  - Etcd (Embedded)
- node1.example.com
  - OpenShift Node (Dedicated)

Total OpenShift Masters: 1
Total OpenShift Nodes: 2

NOTE: Add a total of 3 or more Masters to perform an HA installation.

Do you want to add additional hosts? [y/N]: y
Enter hostname or IP address: node2.example.comWill this host be an OpenShift Master? [y/N]: n

*** Installation Summary ***

Hosts:
- master.example.com
  - OpenShift Master
  - OpenShift Node (Unscheduled)
  - Etcd (Embedded)
- node1.example.com
  - OpenShift Node (Dedicated)
- node2.example.com
  - OpenShift Node (Dedicated)

Total OpenShift Masters: 1
Total OpenShift Nodes: 3

NOTE: Add a total of 3 or more Masters to perform an HA installation.

Do you want to add additional hosts? [y/N]:n

A list of the facts gathered from the provided hosts follows. Because it is
often the case that the hostname for a system inside the cluster is different
from the hostname that is resolveable from command line or web clients
these settings cannot be validated automatically.

For some cloud providers the installer is able to gather metadata exposed in
the instance so reasonable defaults will be provided.

Plese confirm that they are correct before moving forward.


master.example.com,192.168.56.106,192.168.56.106,master.example.com,master.example.com
node1.example.com,192.168.56.107,192.168.56.107,node1.example.com,node1.example.com
node2.example.com,192.168.56.108,192.168.56.108,node2.example.com,node2.example.com

Format:

connect_to,IP,public IP,hostname,public hostname

Notes:
 * The installation host is the hostname from the installer's perspective.
 * The IP of the host should be the internal IP of the instance.
 * The public IP should be the externally accessible IP associated with the instance
 * The hostname should resolve to the internal IP from the instances
   themselves.
 * The public hostname should resolve to the external ip from hosts outside of
   the cloud.

Do the above facts look correct? [y/N]: y
Ready to run installation process.

If changes are needed please edit the config file above and re-run.

Are you ready to continue? [y/N]: y

......

在出现大段的验证信息后(这个信息会出现3次,分别是 master、node1、node2的验证信息),
马上在另一个终端执行:
oc create -f master-subnet.json;
oc create -f node1-subnet.json;
oc create -f node2-subnet.json;


......

PLAY RECAP ********************************************************************
localhost                  : ok=13   changed=0    unreachable=0    failed=0
master.example.com         : ok=222  changed=57   unreachable=0    failed=0
node1.example.com          : ok=60   changed=21   unreachable=0    failed=0
node2.example.com          : ok=60   changed=21   unreachable=0    failed=0


The installation was successful!

If this is your first time installing please take a look at the Administrator
Guide for advanced options related to routing, storage, authentication and much
more:

http://docs.openshift.com/enterprise/latest/admin_guide/overview.html

Press any key to continue ...

4. 测试
oc get node
输出如下:
NAME                 LABELS                                      STATUS                     AGE
master.example.com   kubernetes.io/hostname=master.example.com   Ready,SchedulingDisabled   12d
node1.example.com    kubernetes.io/hostname=node1.example.com    Ready                      12d
node2.example.com    kubernetes.io/hostname=node2.example.com    Ready                      12d
 

没有评论: