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