Chinaunix首页 | 论坛 | 博客
  • 博客访问: 408635
  • 博文数量: 119
  • 博客积分: 1470
  • 博客等级: 上尉
  • 技术积分: 1258
  • 用 户 组: 普通用户
  • 注册时间: 2006-02-24 13:50
文章分类

全部博文(119)

文章存档

2018年(6)

2017年(11)

2016年(4)

2013年(8)

2012年(1)

2011年(2)

2010年(4)

2009年(37)

2008年(16)

2006年(30)

我的朋友

分类: 云计算

2017-06-23 17:33:53

Prerequisites: CentOS 7.x minimal install (tested on 7.2)

Updated 2016/06/05: to docker 1.11.x & OPENSHIFT_VERSION=v1.2.0

Mode: Single node setup, all manual.

Step 1: Install docker and tweak INSECURE_REGISTRY for smoother operation on “integrated docker registry”.

Fix DNS (as needed)

  1. tee -a /etc/hosts << '__EOF__'

  2. 192.168.1.145 osv3-single
  3. __EOF__
  1. cat > /etc/yum.repos.d/docker.repo << '__EOF__'
  2. [docker]
  3. name=Docker Repository
  4. baseurl=
  5. enabled=1
  6. gpgcheck=1
  7. gpgkey=
  8. __EOF__

  9. yum -y install docker-engine wget git

Tweak for systemd way of setting INSECURE_REGISTRY

Ref:

  1. mkdir -p /etc/systemd/system/docker.service.d

  2. cat > /etc/systemd/system/docker.service.d/override.conf << '__EOF__'
  3. [Service]
  4. ExecStart=
  5. ExecStart=/usr/bin/docker daemon --storage-driver=overlay --insecure-registry 172.30.0.0/16 -H fd://
  6. __EOF__

  7. systemctl daemon-reload
  8. systemctl enable docker

  9. systemctl restart docker
Step 2: Get the binaries
  1. mkdir /opt/openshift-origin-v1.2
  2. chmod 755 /opt /opt/openshift-origin-v1.2
  3. cd /opt/openshift-origin-v1.2
  4. wget
  5. tar -zxvf openshift-origin-server-*.tar.gz --strip-components 1
  6. rm -f openshift-origin-server-*.tar.gz
Step 3: Set and load the environments
  1. cat > /etc/profile.d/openshift.sh << '__EOF__'
  2. export OPENSHIFT=/opt/openshift-origin-v1.2
  3. export OPENSHIFT_VERSION=v1.2.0
  4. export PATH=$OPENSHIFT:$PATH
  5. export KUBECONFIG=$OPENSHIFT/openshift.local.config/master/admin.kubeconfig
  6. export CURL_CA_BUNDLE=$OPENSHIFT/openshift.local.config/master/ca.crt
  7. __EOF__
  1. chmod 755 /etc/profile.d/openshift.sh
  2. . /etc/profile.d/openshift.sh
  1. # optional: pre-fetch required docker images
  2. docker pull openshift/origin-pod:$OPENSHIFT_VERSION
  3. docker pull openshift/origin-sti-builder:$OPENSHIFT_VERSION
  4. docker pull openshift/origin-docker-builder:$OPENSHIFT_VERSION
  5. docker pull openshift/origin-deployer:$OPENSHIFT_VERSION
  6. docker pull openshift/origin-docker-registry:$OPENSHIFT_VERSION
  7. docker pull openshift/origin-haproxy-router:$OPENSHIFT_VERSION
Step 4a: Generate OpenShift V3 configuration files
  1. ./openshift start --write-config=openshift.local.config
  2. chmod +r $OPENSHIFT/openshift.local.config/master/admin.kubeconfig
  3. chmod +r $OPENSHIFT/openshift.local.config/master/openshift-registry.kubeconfig
  4. chmod +r $OPENSHIFT/openshift.local.config/master/openshift-router.kubeconfig
Optional: change the default router subdomain in master-config.yaml
  1. sed -i 's/router.default.svc.cluster.local/apps.sudhaker.com/' \
  2. $OPENSHIFT/openshift.local.config/master/master-config.yaml
Step 4b: Add firewall rules
  1. firewall-cmd --permanent --zone=public --add-port=80/tcp
  2. firewall-cmd --permanent --zone=public --add-port=443/tcp
  3. firewall-cmd --permanent --zone=public --add-port=8443/tcp
  4. firewall-cmd --reload
Step 4c: Launch OpenShift V3
  1. nohup ./openshift start &
Or install as serviced daemon and then launch.
  1. cat > /etc/systemd/system/openshift-origin.service << '__EOF__'
  2. [Unit]
  3. Description=Origin Master Service
  4. After=docker.service
  5. Requires=docker.service
  6. [Service]
  7. Restart=always
  8. RestartSec=10s
  9. ExecStart=/opt/openshift-origin-v1.2/openshift start
  10. WorkingDirectory=/opt/openshift-origin-v1.2
  11. [Install]
  12. WantedBy=multi-user.target
  13. __EOF__
  14. systemctl daemon-reload
  15. systemctl enable openshift-origin
  16. systemctl start openshift-origin
Basic product installation is completed. Congratulations!
  1. [root@osv3-single openshift-origin-v1.1]# oc login -u system:admin -n default
  2. You have access to the following projects and can switch between them with 'oc project ':
  3. * default (current)
  4. * openshift
  5. * openshift-infra
  6. Using project "default".
Step 5a: Create an admin account
  1. # to create an admin user for management
  2. oadm policy add-cluster-role-to-user cluster-admin admin
Step 5b: Install the integrated registry (new version has simplified the process)
  1. mkdir /opt/openshift-registry
  2. chcon -Rt svirt_sandbox_file_t /opt/openshift-registry
  3. chown 1001.root /opt/openshift-registry
  4. oadm policy add-scc-to-user privileged -z registry
  5. oadm registry --service-account=registry --mount-host=/opt/openshift-registry
  1. [root@osv3-single openshift-origin-v1.2]# oc get svc docker-registry
  2. NAME CLUSTER-IP EXTERNAL-IP PORT(S) AGE
  3. docker-registry 172.30.1.10 5000/TCP 10m
Step 5c: Install the router
  1. oadm policy add-scc-to-user hostnetwork -z router
  2. oadm router router --replicas=1 --service-account=router
Verify:
  1. [root@osv3-single openshift-origin-v1.2]# oc status
  2. In project default on server
  3. svc/docker-registry - 172.30.1.10:5000
  4. dc/docker-registry deploys docker.io/openshift/origin-docker-registry:v1.2.0-rc1
  5. deployment #1 deployed 9 minutes ago - 1 pod
  6. svc/kubernetes - 172.30.0.1 ports 443, 53, 53
  7. svc/router - 172.30.30.140 ports 80, 443, 1936
  8. dc/router deploys docker.io/openshift/origin-haproxy-router:v1.2.0-rc1
  9. deployment #1 deployed 2 minutes ago - 1 pod
  10. View details with 'oc describe /' or list everything with 'oc get all'.
Step 6: Install the default image-streams (after registry is deployed and live)
  1. cd ~
  2. git clone
  3. cd openshift-ansible/roles/openshift_examples/files/examples/latest/
  4. for f in image-streams/image-streams-centos7.json; do cat $f | oc create -n openshift -f -; done
  5. for f in db-templates/*.json; do cat $f | oc create -n openshift -f -; done
  6. for f in quickstart-templates/*.json; do cat $f | oc create -n openshift -f -; done














阅读(670) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~