日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

openshift介绍及centos7安装单节点openshift、Redhat安装openshift集群完全教程

發布時間:2025/1/21 编程问答 41 豆豆
生活随笔 收集整理的這篇文章主要介紹了 openshift介绍及centos7安装单节点openshift、Redhat安装openshift集群完全教程 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

Centos7中openshift_3.11單節點安裝及配置開機自啟詳解

本次openshift安裝使用最簡單便捷的單節點安裝,適用于本地開發及測試

openshift簡介

OpenShift是紅帽公司2015年開始推出的一個開源容器應用平臺,是一款Paas(平臺即服務)平臺的產品,底層以docker為容器引擎,kubernetes來做編排,部署快捷,功能豐富。

本文包含了openshift的安裝及openshift如何開機自啟和openshift常用命令等內容!下面就直接開始一系列的安裝操作!

安裝注意事項

需保證服務器沒有安裝k8s集群

openshift內置了k8s的安裝過程,在oc cluster up啟動的過程中會安裝k8s

一、環境準備

基礎環境:
系統:Centos7.6.1810
內存:8G(勉強夠用)

[root@cpe-172-250-210-30 opt]# cat /etc/centos-release CentOS Linux release 7.6.1810 (Core) 12

關閉防火墻和selinux

$ sed -i "s/SELINUX=enforcing/SELINUX=permissive/g" /etc/selinux/config $ systemctl stop firewalld $ systemctl disable firewalld 123

安裝docker

$ yum install -y yum-utils $ yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo $ yum -y install docker-ce 123

docker的安裝過程就不詳細說了,如果有需要,看之前寫的筆記吧,這個就不單獨寫博客了
文檔:docker-yum安裝詳解
配置docker私有倉庫地址
因為openshift安裝成功后,會自行啟動一個registry的私有倉庫鏡像以便使用,為了之后不用重新配置后還要重啟docker,所以在此先行配置
集群自動啟動的registry倉庫地址就是172.30.x.x,所以如下配置

$ cat /etc/docker/daemon.json {"insecure-registries": ["172.30.0.0/16"] } $ systemctl daemon-reload $ systemctl start docker $ systemctl enable docker 1234567

二、開始安裝

下載openshift
命令下載即可,如果要下載其他版本,可以去openshift的GitHub項目中下載:https://github.com/openshift/origin/releases

$ cd /opt/ $ wget https://github.com/openshift/origin/releases/download/v3.11.0/openshift-origin-server-v3.11.0-0cbc58b-linux-64bit.tar.gz 12

解壓及修改目錄名稱

$ tar -zxvf openshift-origin-server-v3.11.0-0cbc58b-linux-64bit.tar.gz $ mv openshift-origin-server-v3.11.0-0cbc58b-linux-64bit /opt/openshift-server-v3.11.0 12

修改/etc/profile,加入環境變量

PATH=$PATH:/opt/openshift-server-v3.11.0/ $ source /etc/profile 12

三、啟動集群

這里有一點需要注意:啟動集群會在當前目錄下創建集群配置文件等信息,所以要確保執行啟動命令時,所在目錄是你想要的目錄(相當于安裝目錄了)

$ cd /opt/ $ oc cluster up --skip-registry-check=true --public-hostname="172.250.210.30" --no-proxy="172.250.210.30"

參數介紹:

  • –skip-registry-check 代表是否跳過Docker守護進程注冊表什么的檢查
  • –public-hostname 代表暴露在外部供訪問的地址
  • –no-proxy 代表哪些地址不需要轉發(如果不加這個,有可能部署成功后訪問地址會轉發到 localhost 127.0.0.1)
    啟動成功的最后會有這個輸出
Login to server ... Creating initial project "myproject" ... Server Information ... OpenShift server started. The server is accessible via web console at:https://192.168.116.101:8443 You are logged in as:User: developerPassword: <any value> To login as administrator:oc login -u system:admin [root@master1 ~]# oc status In project My Project (myproject) on server https://192.168.116.101:8443 You have no services, deployment configs, or build configs. Run 'oc new-app' to create an application.

訪問測試
http://主機IP:8443

openshift默認用戶:

  • system:admin 使用密鑰,無密碼
  • developer/developer
  • admin/admin
    到這里一個簡單的openshift集群已經完成了!

四、擴展內容

(一)集群docker-registry測試

命令行登錄集群:

$ oc login -u system:admin 系統管理員用戶,可以查詢到所有信息 $ oc login -u admin -p admin 普通用戶登錄方式 12

查看環境services等信息

[root@cpe-172-250-210-30 ~]# oc get all NAME READY STATUS RESTARTS AGE pod/docker-registry-1-q74b8 1/1 Running 1 1d pod/persistent-volume-setup-mzc8n 0/1 Completed 0 1d pod/router-1-hnrpc 1/1 Running 1 1d NAME DESIRED CURRENT READY AGE replicationcontroller/docker-registry-1 1 1 1 1d replicationcontroller/router-1 1 1 1 1d NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE service/docker-registry ClusterIP 172.30.1.1 <none> 5000/TCP 1d service/kubernetes ClusterIP 172.30.0.1 <none> 443/TCP 1d service/router ClusterIP 172.30.119.137 <none> 80/TCP,443/TCP,1936/TCP 1d NAME DESIRED SUCCESSFUL AGE job.batch/persistent-volume-setup 1 1 1d NAME REVISION DESIRED CURRENT TRIGGERED BY deploymentconfig.apps.openshift.io/docker-registry 1 1 1 config deploymentconfig.apps.openshift.io/router 1 1 1 config 123456789101112131415161718192021

從輸出的信息中可以查看到配置的有私有倉庫replicationcontroller/docker-registry-1
查看鏡像

-n 代表命名空間
看起來這些鏡像應該也都是現從openshift的倉庫中拉下來的,本地的這個相當于轉發倉庫

$ oc get all -n openshift 1


獲取鏡像測試

[root@cpe-172-250-210-30 ~]# docker pull 172.30.1.1:5000/openshift/nginx Using default tag: latest Error response from daemon: unauthorized: authentication required 123

這樣直接去獲取鏡像,輸出Error response from daemon: unauthorized: authentication required,由此可見,獲取鏡像還需要用戶驗證,故:
獲取用戶token(任一用戶均可)

[root@cpe-172-250-210-30 ~]# oc login -u system -p admin Login successful. You don't have any projects. You can try to create a new project, by runningoc new-project <projectname> [root@cpe-172-250-210-30 ~]# oc whoami -t 8zDcvQGrS-zy0A9Q-ugXGZ6kIr8zkuKNsLWf5l73iQk

登錄docker-registry倉庫

[root@cpe-172-250-210-30 ~]# docker login 172.30.1.1:5000 Username: system Password: WARNING! Your password will be stored unencrypted in /root/.docker/config.json. Configure a credential helper to remove this warning. See https://docs.docker.com/engine/reference/commandline/login/#credentials-store

重新獲取測試

[root@cpe-172-250-210-30 ~]# docker pull 172.30.1.1:5000/openshift/nginx Using default tag: latest latest: Pulling from openshift/nginx ab5ef0e58194: Extracting [> ] 557.1kB/75.78MB b04f3cd8f5dc: Download complete ………………

獲取成功

(二)配置openshift開機自啟

如果需要開機自啟,則可以在/etc/rc.d/rc.local中添加上面集群啟動時的命令,就可以實現了
(注意不同環境下需要修改oc命令所在路徑和服務器IP)

/opt/openshift-server-v3.11.0/oc cluster up --skip-registry-check=true --public-hostname="172.250.210.30" --no-proxy="172.250.210.30"

(三)集群常用命令

用戶相關命令

oc login -u 用戶-p 密碼 登陸集群 oc logout 登出集群 oc login -u system:admin 系統管理員登錄 oc create user admin 創建用戶 oc adm policy add-cluster-role-to-user cluster-admin admin 賦予普通用戶系統管理員權限 oc whoami 查看當前用戶(-t 查看token) oc get users 查看集群用戶

集群狀態相關命令

oc cluster up 啟動集群 oc cluster down 停止集群 oc status 查看集群狀態 oc get all 獲取環境所有信息 oc get pod 列出集群pod oc get images 列出集群docker鏡像 oc logs -f podname 查看pod日志 oc get project 查詢項目列表 oc project <project_name> 切換到項目 oc rsh <project_name> 到容器中執行命令(相當于docker exec -ti)

openshift簡介

1、Docker

優勢:構建一個隔離的、穩定的、安全的、高性能的容器運行環境

2、Kubernetes

容器編排
1)容器調度:按業務的需求快速部署容器到指定的目標
2)彈性伸縮:按業務的需求快速擴展或收縮容器的運行實例數量
3)異常自愈:當容器實例運行異常,集群能自動感知、處理并恢復服務狀態
4)持久化卷:為散布在集群不同機器上的容器提供持久化的智能對接
5)服務發現:為業務為服務化提供服務發現及負載均衡等功能
6)配置管理:為業務應用提供靈活的配置管理及分發規則

3、Openshift

容器云,在Docker和Kubernetes的基礎上提供了各種功能,以滿足業務應用、研發用戶及運維用戶在生產效率上的訴求

1)應用開發框架及中間件

? OpenShift提供了豐富的開箱即用的編程開發框架及中間件,如Java、PHP、Ruby、Python、JBossEAP、Tomcat、MySQL、MongoDB及JBoss系列中間件等

2)應用及服務目錄

? OpenShift提供了如軟件市場式的服務及應用目錄,可以實現用戶一鍵部署各類應用及服務,比如一鍵部署Hadoop集群和Spark集群

3)自動化流程及工具

? OpenShift內置了自動化流程工具S2I(SourcetoImage),幫助用戶自動化完成代碼的編譯、構建及鏡像發布

4)軟件自定義網絡

? 通過OpenVSwitch,OpenShift為用戶提供了靈活強健的軟件定義網絡。實現跨主機共享網絡及多租戶隔離網絡模式

5)性能監控及日志管理

? OpenShift提供了開箱可用的性能監控及日志管理的組件。通過平臺,業務能快速獲取運行狀態指標,對業務日志進行收集及分析

6)多用戶接口

? OpenShift提供了友好的Web用戶界面、命令行工具及RESTfulAPI

7)自動化集群部署及管理

? OpenShift通過Ansible實現了集群的自動化部署,為集群的自動化擴容提供了接口

什么是openshift

Openshift是一個開源的容器云平臺,底層基于當前容器的事實標準編排系統Kubernetes和docker引擎,企業可以基于此平臺搭建內部Paas平臺,貫穿CI/CD流程,提高企業IT效率,擁抱DevOps和敏捷開發。

什么是Paas

PaaS(Platform as a Service,平臺即服務)最早是在云計算領域被提出。如下圖所示,將企業IT服務分為九層,傳統自建數據中心九層設施都需要企業自己維護,成本極高。而云計算架構就相當于把九層架構中的底層一部分外包給云計算服務提供商,根據外包的層次不同,分為IaaS(Infrastructure as a Service,基礎設施即服務),PaaS,SaaS(Software as a Service)三層。

  • IaaS 層為基礎設施運維人員服務、提供計算、存儲、網絡以及其他硬件資源,云平臺使用者可以在上面部署和運行包括操作系統和應用程序在內的任意軟件,無需再為基礎設施的管理而分心。
  • PaaS 層為應用開發人員服務,提供支撐應用運行所需的軟件運行時環境,相關的工具與服務,如數據庫服務、日志服務、監控服務等,讓應用開發者可以專注于交付業務價值的代碼而無需關心應用所需的基礎環境與工具。
  • SaaS 層為一般用戶(最終用戶)服務,提供了一套完整可用的軟件系統,讓一般用戶無需關心技術細節,只需通過瀏覽器、應用客戶端的方式就能使用部署在云上的應用服務。SaaS 產品比如客戶關系管理系統、郵件、虛擬桌面、通信、游戲等。
    [外鏈圖片轉存失敗,源站可能有防盜鏈機制,建議將圖片保存下來直接上傳(img-VnqlvwN8-1611045161385)(https://raw.githubusercontent.com/zdzh/photo/master/img1/20190812151837.png)]

什么是Kubernetes

Kubernetes是一個開源容器編排引擎,用于自動化容器化應用程序的部署,擴展和管理。 Kubernetes的基本概念包括:

  • 一個或多個工作節點(worker node)負責工作負載
  • 一個或多個管理節點(master node)負責管理工作負載
  • 將容器封裝在名為Pod的部署單元,使用Pod為容器提供額外的元數據并且提供在單個部署實體中對多個容器進行分組的功能
  • 創建特殊的資源。例如,服務表示一組Pod和訪問策略,該訪問策略允許容器沒有特定的ip地址也能連接服務。復制控制器(Replication controllers)是另一種用于控制同一時間的Pod副本數量的特殊資源,可以使用此功能自動擴展應用程序以適應其當前需求。

什么是OKD

OKD是Kubernetes的發行版,針對持續應用程序開發和多租戶部署進行了優化。OKD在Kubernetes之上添加了開發人員和運營工具,以便為小型和大型團隊實現快速的應用程序開發,輕松部署和擴展以及長期生命周期維護。
OKD是嵌入了Red Hat OpenShift中的上游Kubernetes發行版,并通過安全性和其他集成概念進行擴展。 OKD在github和文檔中也稱為Origin。

openshift層次結構

OpenShift v3是一個分層系統,旨在盡可能準確地公開底層Docker格式的容器鏡像和Kubernetes概念,重點是幫助開發人員輕松組合應用程序。例如,安裝Ruby,推送代碼和添加MySQL。
其中,docker提供了打包和創建基于linux的輕量容器鏡像的抽象;Kubernetes提供了集群管理以及在多臺主機上編排容器的功能。OKD提供了以下功能 :

  • 幫助開發人員管理、構建和部署源代碼
  • 管理和推廣大規模的流進系統的鏡像
  • 大規模的應用管理
  • 組織大型開發人員組織的團隊和用戶跟蹤
  • 支持群集的網絡基礎結構
    Openshift 實際上由三部分組成,核心部分實現容器的調度是封裝的 Kubernetes, 除此之外還有一個內置的鏡像倉庫(Image Registry),這個倉庫是可選的,Openshift 也可以配置使用 Dockerhub 或者企業自己的鏡像倉庫,最外層部分是一個友好的 Web 界面,用于展示和操作 Openshift 的資源。
    如下圖所示,Openshift 要成為一個完整的數字化平臺需要依賴于兩個外部系統,一個代碼庫,一個是持續集成服務,事實上這兩個外部服務也是可以跑在 Openshift 里面的。右邊的灰色矩形就是 Openshift 的主要架構了,它的上層是一個路由(Router),用于 DNS 解析和轉發,確保用戶能夠調用到 Openshift 集群中的服務。中間部分是跑在 RHEL 操作系統上的 Kubernetes 集群,側面是外部存儲服務,因為集群里的計算單元是漂浮的,所以通常 Kubernetes 集群只提供計算能力,數據持久外需要依賴外部的比如說 S3,EBS 等云服務商提供的存儲服務。最下層同樣也是由云服務商提供的基礎設施服務。
    [外鏈圖片轉存失敗,源站可能有防盜鏈機制,建議將圖片保存下來直接上傳(img-J0V4l5cs-1611045161391)(https://raw.githubusercontent.com/zdzh/photo/master/img1/20190812112313.png)]

Pods

okd引用了kubernetes的pods概念。pods是指在同一臺主機上運行的一個或多個容器,它是定義、開發和部署的最小單位。 每個pod都分配有自己的內部IP地址,因此擁有其整個端口空間,pod中的容器可以共享其本地存儲和網絡。
pod的生命周期可以在容器退出時結束,也可以在容器退出后保留pods以方便訪問容器日志。
pod在運行過程中無法被修改,當需要修改時,需要先停止pod再根據修改后的配置文件和鏡像重新創建pod。pod退出時不會保留狀態,因此一般通過更高級的控制器管理pods而不是用戶直接管理。

Redhat OpenShift安裝與部署

一 前置條件說明

1.1 安裝準備概述

Red Hat OpenShift容器平臺是由Red Hat作為RPM包和容器映像兩種類型存在。RPM包使用訂閱管理器從標準Red Hat存儲庫(即Yum存儲庫)下載,容器映像來自Red Hat私有倉庫。
OpenShift容器平臺安裝需要多個服務器,支持服務器或虛擬機的多種形式。同時為了簡化OpenShift集群的部署,Red Hat提供了一個基于Ansible的安裝程序,它可以通過交互運行,也可以使用包含環境配置細節的應答文件以自動的非交互方式運行。
在運行安裝程序之前,需要執行一些預安裝任務,以及安裝后的安裝任務,以獲得功能齊全的OpenShift容器平臺集群。RedHat為安裝OpenShift容器平臺提供了兩種不同的方法。

  • 第一種方法使用快速安裝程序,可用于簡單的集群設置。
  • 第二種方法是較為精細的安裝方式,并使用Ansible playbook來自動化該過程。
    本實驗使用Ansible來自動配置OpenShift集群。同時,Ansible可以為OpenShift安裝準備主機,例如包安裝、禁用服務和客戶化配置。
    提示:更多Ansible內容參考https://www.cnblogs.com/itzgr/category/1333622.html

1.2 節點準備

需要相應的master和node節點互通,并且配置master至所有節點的免秘鑰登錄。同時能解析所有FQDN,及注冊相應repo庫。
提示:以上準備工作也可通過Ansible直接跑相應的yml完成。

二 實驗一:前置條件操作

2.1 環境準備

[student@workstation ~]$ lab install-prepare setup #運行準備腳本

提示:本環境基于RedHat RH280環境,所有lab命令為環境自動化準備命令,后續不再贅述。

2.2 安裝Ansible

[student@workstation ~]$ rpm -qa | grep ansible [student@workstation ~]$ sudo yum -y install ansible

2.3 驗證Ansible

[student@workstation ~]$ cd /home/student/DO280/labs/install-prepare/ [student@workstation ~]$ ansible --version [student@workstation install-prepare]$ cat ansible.cfg

[student@workstation install-prepare]$ cat inventory


Inventory文件解釋:
Inventory定義了六個主機組:

  • workstations:為developer節點,即運行playbook的節點;
  • nfs:為集群存儲提供nfs服務的環境中的vm;
  • masters:OpenShift集群中用作master角色的節點;
  • etcd:用于OpenShift集群的etcd服務的節點,本環境中使用master節點;
  • node:OpenShift集群中的node節點;
  • OSEv3:組成OpenShift集群的所有接待,包括master、etcd、node或nfs組中的節點。
    注意:默認情況下,docker使用在線倉庫下載容器映像。本環境內部無網絡,因此將docker倉庫配置為內部私有倉庫。在yml中使用變量引入倉庫配置。
    此外,安裝會在每個主機上配置docker守護進程,以使用overlay2 image驅動程序存儲容器映像。Docker支持許多不同的image驅動。如AUFS、Btrfs、Device mapper、OverlayFS。

2.4 檢查節點連通性

[student@workstation install-prepare]$ cat ping.yml 1 ---2 - name: Verify Connectivity3 hosts: all4 gather_facts: no5 tasks:6 - name: "Test connectivity to machines."7 shell: "whoami"8 changed_when: false [student@workstation install-prepare]$ ansible-playbook -v ping.yml

2.5 確認yml

[student@workstation install-prepare]$ cat prepare_install.yml


解釋:如上yml引入了三個role。
docker-storage內容如下,該role定義相關docker的后端存儲驅動以及創建docker所需的image存儲路徑,并最終啟動docker。
[student@workstation install-prepare]$ cat roles/docker-storage/tasks/main.yml

1 ---2 - block:3 - name: Customize default /etc/sysconfig/docker-storage-setup4 template:5 src: docker-storage-setup6 dest: /etc/sysconfig/docker-storage-setup7 owner: root8 group: root9 mode: 064410 when: not use_overlay2_driver11 - name: Customize /etc/sysconfig/docker-storage-setup using overlay2 storage driver12 template:13 src: docker-storage-setup-overlay214 dest: /etc/sysconfig/docker-storage-setup15 owner: root16 group: root17 mode: 064418 when: use_overlay2_driver19 - name: Verify existence of /dev/docker-vg/docker-pool20 stat:21 path: /dev/docker-vg/docker-pool22 register: p23 - name: Stop docker24 service:25 name: docker26 state: stopped27 when: p.stat.exists == False28 - name: Remove loopback docker files29 file:30 dest: /var/lib/docker31 state: absent32 when: p.stat.exists == False33 - name: Run docker-storage-setup34 command: /usr/bin/docker-storage-setup35 when: p.stat.exists == False36 - name: Start and enable docker37 service:38 name: docker39 state: started40 when: p.stat.exists == False41 when: docker_storage_device is defined42

[student@workstation install-prepare]$ cat roles/docker-storage/templates/docker-storage-setup

1 DEVS={{ docker_storage_device }}2 VG=docker-vg3 SETUP_LVM_THIN_POOL=yes

docker-registry-cert內容如下,該role定義相關docker的使用私有倉庫,并且導入了相關crt證書。
[student@workstation install-prepare]$ cat roles/docker-registry-cert/tasks/main.yml

1 ---2 - name: Enable the Trust3 shell: update-ca-trust enable4 - name: Retrieve the certificate5 fetch:6 src: "{{ cacert }}"7 dest: "{{ local_destination }}"8 delegate_to: "{{ registry_host }}"9 - name: Copy the certificate10 copy:11 src: "{{ source }}"12 dest: "{{ destination }}"13 owner: root14 group: root15 mode: 075516 - name: Update the Trust17 shell: update-ca-trust extract18 - name: Restart Docker19 service:20 name: docker21 state: restarted22

[student@workstation install-prepare]$ cat roles/docker-registry-cert/vars/main.yml

1 registry_host: services.lab.example.com2 cacert: /etc/pki/tls/certs/example.com.crt3 local_destination: /tmp/4 source: "/tmp/{{ ansible_fqdn }}/etc/pki/tls/certs/example.com.crt"5 destination: /etc/pki/ca-trust/source/anchors/example.com.crt

openshift-node內容如下,該role定義相關安裝OpenShift所需的所有依賴包任務。
[student@workstation install-prepare]$ ll roles/openshift-node/files/
total 4
-rw-r–r--. 1 student student 389 Jul 19 2018 id_rsa.pub
[student@workstation install-prepare]$ cat roles/openshift-node/meta/main.yml

1 ---2 dependencies:3 - { role: docker }

[student@workstation install-prepare]$ cat roles/openshift-node/tasks/main.yml

1 ---2 - name: Deploy ssh key to root at all nodes3 authorized_key:4 user: root5 key: "{{ item }}"6 with_file:7 - id_rsa.pub8 - name: Install required packages9 yum:10 name: "{{ item }}"11 state: latest12 with_items:13 - wget14 - git15 - net-tools16 - bind-utils17 - iptables-services18 - bridge-utils19 - bash-completion20 - kexec-tools21 - sos22 - psacct23 - atomic-openshift-clients24 - atomic-openshift-utils25 - atomic-openshift26

2.6 運行playbook

[student@workstation ~]$ cd /home/student/DO280/labs/install-prepare/
[student@workstation install-prepare]$ ansible-playbook prepare_install.yml

提示:該準備工作將完成如下操作:

  • 在每個節點上安裝并運行Docker;
  • 在每個節點上Docker使用一個邏輯卷存儲;
  • 每個節點使用自簽名證書信任私有Docker倉庫;
  • 在每個節點上都會安裝基本包。

2.7 確認驗證

[student@workstation install-prepare]$ for vm in master node1 node2;
do echo -e “\n$vm”
ssh KaTeX parse error: Expected 'EOF', got '#' at position 54: … -n3 done #?驗證docker服務 [![c… for vm in master node1 node2;
do echo -e “\n$vm : lvs”
ssh KaTeX parse error: Undefined control sequence: \n at position 22: …o lvs echo -e "\?n?vm : df -h"
ssh KaTeX parse error: Expected 'EOF', got '#' at position 42: …cker done #?查看docker使用的lvm … for vm in master node1 node2;
do echo -e “\n$vm”
ssh KaTeX parse error: Expected 'EOF', got '#' at position 38: …atest done #?測試pull image [!… for vm in master node1 node2;
do echo -e “\n$vm”
ssh $vm rpm -qa wget git net-tools bind-utils
yum-utils iptables-services bridge-utils bash-completion
kexec-tools sos psacct atomic-openshift-utils
done #檢查相關依賴包是否安裝成功

三 正式安裝說明

3.1 安裝步驟

安裝準備完成后正式安裝包括四個步驟:

  • 編寫一個目錄文件來描述所需的集群特性和體系結構;
  • 執行prerequisites.yml的playbook;
  • 執行deploy_cluster,yml的playbook;
  • 驗證安裝。

3.2 安裝和配置節點

OpenShift Inventory定義了以下主機組。
master:對于OpenShift,這是必須的組,定義了OpenShift集群中哪些主機充當master節點;
node:對于OpenShift,這是必須的組,它定義了OpenShift集群中哪些主機充當node節點;
etcd:[master]部分中列出的所有主機也應屬于etcd;
nfs:這個組是可選的,應該只包含一個主機。如果Inventory文件中存在特定的變量,OpenShift playbook將在這臺機器上安裝并配置NFS;
OSEv3:這個組包含任何屬于OpenShift集群的機器。安裝劇本引用這個組來運行在集群全范圍內的任務。
[student@workstation install-prepare]$ cat inventory

說明:

  • 安裝所需版本的OpenShift容器平臺;
  • 用戶使用htpasswd身份驗證對集群進行身份驗證;
  • DNS條目apps.lab.example.com用作OpenShift應用程序的子域;
  • NFS存儲用于OpenShift etcd服務和OpenShift 內部倉庫;
  • classroom container registry用作倉庫。
    變量說明:
    OpenShift安裝變量記錄在Inventory的[OSEv3:vars]部分。安裝變量用于配置多個OpenShift組件,例如:
  • 一個內部容器倉庫;
  • Gluster、Ceph等以便于提供持久性存儲;
  • 集群日志;
  • 自定義集群證書。

3.3 配置OpenShift版本

可通過在[OSEv3:vars]中指定如下配置確定OpenShift所安裝的版本:
openshift_deployment_type=openshift-enterprise
openshift_release=v3.9
指定OpenShift部署類型,可選值為openshift-enterprise和origin。
openshift_image_tag=v3.9.14
openshift_disable_check=disk_availability,docker_storage,memory_availability
容器化的OpenShift服務使用帶有“v3.9.14”標記的圖像。這將阻止集群自動升級到更新的容器映像;
對于非生產集群,可以禁用對系統需求的檢查。

3.4 配置驗證

OpenShift容器平臺身份驗證基于OAuth, OAuth提供了一個基于HTTP的APl,用于對交互式和非交互式客戶端進行身份驗證。
OpenShift master運行一個OAuth服務器,OpenShift可以支持多種Provider,這些Provider可以與特定于組織的身份管理產品集成。支持的OpenShift身份驗證的Provider:

  • HTTP Basic,外部單點登錄(SSO)系統;
  • 使用GitHub和GitLab帳號;
  • OpenID連接,使用OpenID-compatible SSO和谷歌帳戶;
  • OpenStack Keystone v3;
  • LDAP v3服務器。
    OpenShift安裝程序使用默認的安全方法,DenyAllPasswordIdentityProvider是缺省提供程序。使用此Provider,表示只有master主機上的root用戶才能使用OpenShift客戶端命令和API。

3.5 配置htpasswd驗證

OpenShift HTPasswdPasswordIdentityProvider根據Apache HTTPD htpasswd程序生成的文件驗證用戶和密碼。
htpasswd程序將用戶名和密碼保存在純文本文件中,每行一條記錄,字段用冒號分隔。密碼使用MD5散列。如果將此文件添加或刪除用戶,或更改用戶密碼,OpenShift OAuth服務器將自動重新讀取該文件。
要將OpenShift master配置使用HTPasswdPasswordIdentityProvider,需要配置openshift_master_identity_providers。

1 openshift_master_identity_providers。2 openshift_master_identity_providers=[{'name': 'htpasswd_auth', 'login': 'true',3 'challenge': 'true', 'kind': 'HTPasswdPasswordIdentityProvider', #配置后端驅動4 'filename': '/etc/origin/master/htpasswd'}] #制定master主機上

也支持在配置文件中直接指定初始的用戶名和密碼。
openshift_master_htpasswd_users="{‘user1’:’apr1apr1apr1.NHMsZYcMdmfWN5DM3q280/W7c51c/′,′user2′:′MdmfWN5DM3q280/W7c51c/', 'user2':'MdmfWN5DM3q280/W7c51c/,user2:apr1.NHMsZYc.NHMsZYc.NHMsZYcMdmfWN5DM3q280/W7c51c/’}"
生產hash密碼可參考如下:

1 [student@workstation ~]$ htpasswd -nb admin redhat2 [student@workstation ~]$ openssl passwd -apr1 redhat

3.6 網絡要求

集群節點的通配符DNS條目允許任何新創建的路由自動路由到subdomain的集群。通配符DNS條目必須存在于唯一的子域中,例如apps.mycluster.com,并解析為主機名或集群節點的IP地址。inventory文件中通配符DNS條目是通過變量openshift_master_default_subdomain進行設置 。
openshift_master_default_subdomain=apps.mycluster.com

3.7 master服務端口

主服務端口openshift_master_api_port變量定義主API的監聽端口。缺省端口8443,當master使用SSL時,也可以使用443端口。從而在連接的時候省略端口號。
master console端口由openshift_master_console_port變量的值設置,默認端口是8443。master console端口也可以設置為443,從而在連接的時候省略端口號。
3.8 防火墻
OpenShift節點上的默認防火墻服務是iptables。若要在所有節點上使用firewalld作為防火墻服務,需要將操作系統防火墻使用firewalld變量設置為true,即os_firewall_use_firewalld=true。

四 配置持久化存儲

4.1 持久存儲配置

默認情況下,容器數據是臨時的,并且在容器被銷毀時丟失。Kubernetes持久卷框架為容器請求和使用持久存儲提供了一種機制。為了避免數據丟失,這些服務被配置為使用持久卷。
OpenShift支持多個插件,使用各種存儲技術創建持久卷。可以使用NFS、iSCSI、GlusterFS、Ceph或其他商業云存儲。
本環境中,OpenShift容器registry和OpenShift Ansible Broker服務被配置為使用NFS持久性存儲。
提示:生產環境默認OpenShift不支持NFS持久存儲集群,要允許NFS在非生產集群上持久存儲,需要配置openshift_enable_unsupported_configurations=true。

4.2 container倉庫

要為OpenShift容器registry配置NFS持久性存儲,請將以下內容添加到Inventory文件中:

1 openshift_hosted_registry_storage_kind=nfs2 openshift_hosted_registry_storage_nfs_directory=/exports3 openshift_hosted_registry_storage_volume_name=registry4 openshift_hosted_registry_storage_nfs_options='*(rw,root_squash)'5 openshift_hosted_registry_storage_volume_size=40G6 openshift_hosted_registry_storage_access_modes=['ReadWriteMany']

4.3 OpenShift Ansible Broker

OpenShift Ansible Broker(OAB)是一個容器化的OpenShift服務,部署自己的etcd服務。持久Etcd存儲所需的配置與registry所需的配置類似。

1 openshift_hosted_etcd_storage_kind=nfs2 openshift_hosted_etcd_storage_nfs_directory=/exports3 openshift_hosted_etcd_storage_volume_name=etcd-vol24 openshift_hosted_etcd_storage_nfs_options="*(rw,root_squash,sync,no_wdelay)"5 openshift_hosted_etcd_storage_volume_size=1G6 openshift_hosted_etcd_storage_access_modes=["ReadWriteOnce"]7 openshift_hosted_etcd_storage_labels={'storage': 'etcd'}

五 OpenShift其他配置

5.1 配置離線本地registry

本環境OpenShift使用容器倉庫為registry.lab.example.com,要將集群配置為從內部倉庫pull image,需要在Inventory中進行如下配置:

1 #Modifications Needed for a Disconnected Install2 oreg_url=registry.lab.example.com/openshift3/ose-${component}:${version}3 #可訪問image倉庫的位置,必須以ose-${component}:${version}結尾。4 openshift_examples_modify_imagestreams=true5 #OpenShift安裝了用于部署示例應用程序的模板。這個變量指示playbook修改所有示例的IS,使其指向私有倉庫,而不是registry.access.redhat.com。6 openshift_docker_additional_registries=registry.lab.example.com7 #此變量用于將本地可訪問倉庫添加到每個節點上的docker配置中。8 openshift_docker_blocked_registries=registry.access.redhat.com,docker.io9 #此變量用于在OpenShift節點上配置docker的blocked_registries。 1 #Image Prefix Modifications2 openshift_web_console_prefix=registry.lab.example.com/openshift3/oseopenshift_cockpit_deployer_prefix='registry.lab.example.com/openshift3/'3 openshift_service_catalog_image_prefix=registry.lab.example.com/openshift3/osetemplate_service_broker_prefix=registry.lab.example.com/openshift3/oseansible_service_broker_image_prefix=registry.lab.example.com/openshift3/oseansible_service_broker_etcd_image_prefix=registry.lab.example.com/rhel7/

#通過在容器image名稱前面加上registry.lab.example.com以確保OpenShift服務的容器image可以從私有內部倉庫下載。

5.2 配置NODE labels

節點label是分配給每個節點的任意key/value描述。node label通常用于區分地理數據中心或標識節點上的可用資源的有意義的描述。
應用程序可以在其deployment中根據node lables配置一個選擇器。如果匹配到,應用程序的pod必須部署在其符合node labels的節點上。
使用主機變量openshift_node_tags在Inventory文件中設置節點標簽。

1 [nodes]2 ...output omitted...3 nodeX.example.com openshift_node_labels="{'zone':'west', 'gpu':'true'}"4 ...output omitted...

如上所示配置給nodeX.example.com配置兩個labels,zone=west和gpu=true。
OpenShift集群的一個常見架構是區分master、infrastructure node和compute node。
在此架構中,infrastructure node承載OpenShift Pod的registry和路由器,而compute node承載來自用戶項目的應用程序pod。
master節點不承載應用程序或infrastructure pod。
可使用 node label 來標識特定節點的角色,通常master node label 為 node-role.kubernetes.io/master=true,infrastructure node label 為 region=infra,compute node label 為 noderole.kubernetes.io/compute=true。

1 [nodes]2 master.lab.example.com3 node1.lab.example.com openshift_node_labels="{'region':'infra'}"4 node2.lab.example.com

提示:如果一個節點設計為同時承載infrastructure 和 application pods,則必須顯式定義兩個節點標簽。
[nodes]

nodeX.example.com openshift_node_labels="{‘region’:‘infra’, ‘noderole.kubernetes.io/compute’:‘true’}"

六 執行劇本

6.1 劇本說明

安裝OpenShift需要執行prerequisites.yml 和deploy_cluster.yml,由 atomic-openshift-utils 軟件包安裝。
首先執行 prequisites.yml playbook 檢查所有主機能夠滿足OpenShift 的部署,同時嘗試修改主機以滿足部署需求。然后執行 doploy_cluster.yml playbook 開始正式集群部署

6.2 驗證OpenShift

部署完成后,可訪問:https://master.lab.example.com 進行驗證。

七 正式安裝OpenShift

7.1 前置準備

[student@workstation ~]$ lab install-prepare setup
[student@workstation ~]$ sudo yum -y install ansible
[student@workstation ~]$ cd /home/student/do280-ansible/
[student@workstation do280-ansible]$ ansible-playbook playbooks/prepare_install.yml #設置相關環境
[student@workstation do280-ansible]$ lab install-run setup
[student@workstation do280-ansible]$ cd /home/student/DO280/labs/install-run/

7.2 安裝atomic

[student@workstation install-run]$ sudo yum -y install atomic-openshift-utils
提示:atomic-openshift-utils提供了安裝OpenShift所需的Ansible playbook和role。

7.3 創建Inventory

[student@workstation install-run]$ cp inventory.initial inventory
[student@workstation install-run]$ cat inventory

[student@workstation install-run]$ echo -e “\n[OSEv3:vars]” >> inventory

7.4 配置相關安裝版本

1 [student@workstation install-run]$ vi general_vars.txt2 #General Cluster Variables3 openshift_deployment_type=openshift-enterprise #配置為openshift-enterprise版本4 openshift_release=v3.9 #配置版本為v3.95 openshift_image_tag=v3.9.146 openshift_disable_check=disk_availability,docker_storage,memory_availability #禁用check

7.5 設置htpasswd認證

1 [student@workstation install-run]$ openssl passwd -apr1 redhat2 $apr1$/d1L7fdX$duViLRE.JG012VkZDq8bs03 [student@workstation install-run]$ openssl passwd -apr1 redhat4 $apr1$rUMMfQfD$J8CEqQK.YenyNwYwKN1lA1 #創建兩個用戶密碼都為redhat5 [student@workstation install-run]$ vi authentication_vars.txt6 #Cluster Authentication Variables7 openshift_master_identity_providers=[{'name': 'htpasswd_auth', 'login': 'true', 'challenge': 'true', 'kind': 'HTPasswdPasswordIdentityProvider', 'filename': '/etc/origin/master/htpasswd'}]8 openshift_master_htpasswd_users={'admin':'$apr1$/d1L7fdX$duViLRE.JG012VkZDq8bs0', 'developer':'$apr1$rUMMfQfD$J8CEqQK.YenyNwYwKN1lA1'}

7.6 配置集群網絡

1 [student@workstation install-run]$ vi networking_vars.txt2 #OpenShift Networking Variables3 os_firewall_use_firewalld=true #開啟firewall防火墻4 openshift_master_api_port=443 #啟用端口5 openshift_master_console_port=443 #啟用控制端口6 openshift_master_default_subdomain=apps.lab.example.com #指定subdomain

7.7 配置NFS

1 [student@workstation install-run]$ vi persistence_vars.txt2 #NFS is an unsupported configuration3 openshift_enable_unsupported_configurations=true4 5 #OCR configuration variables6 openshift_hosted_registry_storage_kind=nfs7 openshift_hosted_registry_storage_access_modes=['ReadWriteMany']8 openshift_hosted_registry_storage_nfs_directory=/exports9 openshift_hosted_registry_storage_nfs_options='*(rw,root_squash)'10 openshift_hosted_registry_storage_volume_name=registry11 openshift_hosted_registry_storage_volume_size=40Gi12 13 #OAB's etcd configuration variables14 openshift_hosted_etcd_storage_kind=nfs15 openshift_hosted_etcd_storage_nfs_options="*(rw,root_squash,sync,no_wdelay)"16 openshift_hosted_etcd_storage_nfs_directory=/exports17 openshift_hosted_etcd_storage_volume_name=etcd-vol218 openshift_hosted_etcd_storage_access_modes=["ReadWriteOnce"]19 openshift_hosted_etcd_storage_volume_size=1G20 openshift_hosted_etcd_storage_labels={'storage': 'etcd'}

7.8 配置離線倉庫

1 #Modifications Needed for a Disconnected Install2 oreg_url=registry.lab.example.com/openshift3/ose-${component}:${version} #添加內部倉庫3 openshift_examples_modify_imagestreams=true #修改IS4 openshift_docker_additional_registries=registry.lab.example.com #內部倉庫至docker配置5 openshift_docker_blocked_registries=registry.access.redhat.com,docker.io #禁止外部官方倉庫6 #Image Prefixes7 openshift_web_console_prefix=registry.lab.example.com/openshift3/ose-8 openshift_cockpit_deployer_prefix='registry.lab.example.com/openshift3/'9 openshift_service_catalog_image_prefix=registry.lab.example.com/openshift3/ose-10 template_service_broker_prefix=registry.lab.example.com/openshift3/ose-11 ansible_service_broker_image_prefix=registry.lab.example.com/openshift3/ose-12 ansible_service_broker_etcd_image_prefix=registry.lab.example.com/rhel7/

7.9 設置label

[student@workstation install-run]$ vi inventory

1 ……2 [nodes]3 master.lab.example.com4 node1.lab.example.com openshift_node_labels="{'region':'infra', 'node-role.kubernetes.io/compute':'true'}"5 node2.lab.example.com openshift_node_labels="{'region':'infra', 'node-role.kubernetes.io/compute':'true'}"

7.10 合并并校對Inventory

[student@workstation install-run]$ cat general_vars.txt networking_vars.txt authentication_vars.txt persistence_vars.txt disconnected_vars.txt >> inventory
[student@workstation install-run]$ lab install-run grade #本環境提供檢查Inventory的腳本
[student@workstation install-run]$ cat inventory
1 [student@workstation install-run]$ cat general_vars.txt networking_vars.txt authentication_vars.txt persistence_vars.txt disconnected_vars.txt >> inventory 2 [student@workstation install-run]$ lab install-run grade #本環境提供檢查Inventory的腳本 3 [student@workstation install-run]$ cat inventory 4 [workstations] 5 workstation.lab.example.com 6 7 [nfs] 8 services.lab.example.com 9 10 [masters] 11 master.lab.example.com 12 13 [etcd] 14 master.lab.example.com 15 16 [nodes] 17 master.lab.example.com 18 node1.lab.example.com openshift_node_labels="{'region':'infra', 'node-role.kubernetes.io/compute':'true'}" 19 node2.lab.example.com openshift_node_labels="{'region':'infra', 'node-role.kubernetes.io/compute':'true'}" 20 21 [OSEv3:children] 22 masters 23 etcd 24 nodes 25 nfs 26 27 #Variables needed by classroom host preparation playbooks. 28 [nodes:vars] 29 registry_local=registry.lab.example.com 30 use_overlay2_driver=true 31 insecure_registry=false 32 run_docker_offline=true 33 docker_storage_device=/dev/vdb 34 35 36 [OSEv3:vars] 37 #General Cluster Variables 38 openshift_deployment_type=openshift-enterprise 39 openshift_release=v3.9 40 openshift_image_tag=v3.9.14 41 openshift_disable_check=disk_availability,docker_storage,memory_availability 42 #OpenShift Networking Variables 43 os_firewall_use_firewalld=true 44 openshift_master_api_port=443 45 openshift_master_console_port=443 46 openshift_master_default_subdomain=apps.lab.example.com 47 #Cluster Authentication Variables 48 openshift_master_identity_providers=[{'name': 'htpasswd_auth', 'login': 'true', 'challenge': 'true', 'kind': 'HTPasswdPasswordIdentityProvider', 'filename': '/etc/origin/master/htpasswd'}] 49 openshift_master_htpasswd_users={'admin':'$apr1$/d1L7fdX$duViLRE.JG012VkZDq8bs0', 'developer':'$apr1$rUMMfQfD$J8CEqQK.YenyNwYwKN1lA1'} 50 51 #NFS is an unsupported configuration 52 openshift_enable_unsupported_configurations=true 53 54 #OCR configuration variables 55 openshift_hosted_registry_storage_kind=nfs 56 openshift_hosted_registry_storage_access_modes=['ReadWriteMany'] 57 openshift_hosted_registry_storage_nfs_directory=/exports 58 openshift_hosted_registry_storage_nfs_options='*(rw,root_squash)' 59 openshift_hosted_registry_storage_volume_name=registry 60 openshift_hosted_registry_storage_volume_size=40Gi 61 62 #OAB's etcd configuration variables 63 openshift_hosted_etcd_storage_kind=nfs 64 openshift_hosted_etcd_storage_nfs_options="*(rw,root_squash,sync,no_wdelay)" 65 openshift_hosted_etcd_storage_nfs_directory=/exports 66 openshift_hosted_etcd_storage_volume_name=etcd-vol2 67 openshift_hosted_etcd_storage_access_modes=["ReadWriteOnce"] 68 openshift_hosted_etcd_storage_volume_size=1G 69 openshift_hosted_etcd_storage_labels={'storage': 'etcd'} 70 71 #Modifications Needed for a Disconnected Install 72 oreg_url=registry.lab.example.com/openshift3/ose-${component}:${version} 73 openshift_examples_modify_imagestreams=true 74 openshift_docker_additional_registries=registry.lab.example.com 75 openshift_docker_blocked_registries=registry.access.redhat.com,docker.io 76 77 #Image Prefixes 78 openshift_web_console_prefix=registry.lab.example.com/openshift3/ose- 79 openshift_cockpit_deployer_prefix='registry.lab.example.com/openshift3/' 80 openshift_service_catalog_image_prefix=registry.lab.example.com/openshift3/ose- 81 template_service_broker_prefix=registry.lab.example.com/openshift3/ose- 82 ansible_service_broker_image_prefix=registry.lab.example.com/openshift3/ose- 83 ansible_service_broker_etcd_image_prefix=registry.lab.example.com/rhel7/

7.11 執行安裝劇本

[student@workstation install-run]$ ansible-playbook /usr/share/ansible/openshift-ansible/playbooks/prerequisites.yml
#執行準備工作playbook

[student@workstation install-run]$ ansible-playbook /usr/share/ansible/openshift-ansible/playbooks/deploy_cluster.yml

提示:整個部署log保存至本地目錄的ansible.log中。

八 驗證測試

8.1 確認驗證說明

要驗證OpenShift安裝,必須測試和驗證所有OpenShift組件。僅僅從示例容器映像啟動pod是不夠的,因為這并不使用OpenShift builders、deployer、router或內部registry。

  • 建議通過以下方式完整驗證OpenShift:
  • 檢查所有OpenShift節點狀態;
  • 檢查相應的OpenShift registry和router的pod;
  • 使用OpenShift從源代碼構建一個應用程序,OpenShift從構建結果生成容器image,并從該映像啟動pod;
  • 創建一個service,以便可以從內部容器網絡和OpenShift節點訪問應用程序;
  • 創建一個route,以便可以從OpenShift集群外部的計算機訪問應用程序。
    安裝完成后,OpenShift客戶端可以使用oc,master節點可以使用oadm命令。master節點的root用戶將被配置為云管理員的身份運行OpenShift客戶機和管理員命令。
    一些OpenShift內部服務,如內部倉庫和router,默認情況下由安裝程序配置。運行oc get nodes和oc get pods命令,以驗證安裝成功。

8.2 登錄測試

瀏覽器訪問:https://master.lab.example.com

8.3 驗證OpenShift功能

[student@workstation ~]$ oc login -uadmin -predhat https://master.lab.example.com

提示:賬號權限需要單獨授予,安裝過程中創建的adminn并沒有集群的administration特權。

8.4 授予權限

system:admin是唯一一個擁有集群administration權限的賬戶。master節點的root用戶被都為集群的system:admin用戶。
[root@master ~]# oc whoami
system:admin
[root@master ~]# oc adm policy add-cluster-role-to-user cluster-admin admin #添加admin為集群管理員
提示:cluster-admin角色權限非常高,允許管理用戶銷毀和修改集群資源,必須謹慎使用。

8.5 查看節點狀態

再次使用命令登錄。
[student@workstation ~]$ oc login -uadmin -predhat https://master.lab.example.com

[student@workstation ~]$ oc get nodes
NAME STATUS ROLES AGE VERSION
master.lab.example.com Ready master 14h v1.9.1+a0ce1bc657
node1.lab.example.com Ready compute 14h v1.9.1+a0ce1bc657
node2.lab.example.com Ready compute 14h v1.9.1+a0ce1bc657
[student@workstation ~]$ oc get pods
NAME READY STATUS RESTARTS AGE
docker-registry-1-4w5tb 1/1 Running 1 14h
docker-registry-1-j7k59 1/1 Running 1 14h
registry-console-1-mtkxc 1/1 Running 1 14h
router-4-9dfxc 1/1 Running 0 4h
router-4-kh7th 1/1 Running 0 5h

8.6 創建項目

[student@workstation ~]$ oc new-project smoke-test

8.7 創建應用

[student@workstation ~]$ oc new-app --name=hello -i php:7.0 http://registry.lab.example.com/php-helloworld
[student@workstation ~]$ oc get pods -w #監視pod創建

8.8 查看route

[student@workstation ~]$ oc get routes
NAME HOST/PORT PATH SERVICES PORT TERMINATION WILDCARD
hello hello-smoke-test.apps.lab.example.com hello 8080-tcp None

8.9 公開服務

[student@workstation ~]$ oc expose service hello #向外部網絡公開服務

8.10 測試服務

[student@workstation ~]$ curl http://hello-smoke-test.apps.lab.example.com
Hello, World! php version is 7.0.10
[student@workstation ~]$ oc delete project install-post #刪除項目

8.11 測試developer

[student@workstation ~]$ oc login -u developer #使用redhat密碼登錄
[student@workstation ~]$ oc new-project smoke-test
[student@workstation ~]$ oc new-app php:5.6~http://services.lab.example.com/php-helloworld --name hello
[student@workstation ~]$ oc logs -f bc/hello #監視構建過程
提示:輸出表明OpenShift能夠從倉庫clone代碼、并且構建image,同時將新image推入內部倉庫。
[student@workstation ~]$ oc expose svc hello
route “hello” exposed
[student@workstation ~]$ oc get routes
NAME HOST/PORT PATH SERVICES PORT TERMINATION WILDCARD
hello hello-smoke-test.apps.lab.example.com hello 8080-tcp None
[student@workstation ~]$ curl hello-smoke-test.apps.lab.example.com
Hello, World! php version is 5.6.25

參考鏈接

Centos7中openshift_3.11單節點安裝及配置開機自啟詳解
openshift簡介
openshift層次結構
OpenShift安裝與部署

總結

以上是生活随笔為你收集整理的openshift介绍及centos7安装单节点openshift、Redhat安装openshift集群完全教程的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。