This is a cache of https://docs.openshift.com/container-platform/3.6/getting_started/install_openshift.html. It is a snapshot of the page at 2024-11-27T03:39:49.327+0000.
Install OpenShift | Getting Started | OpenShift Container Platform 3.6
×

Overview

This guide introduces you to the basic concepts of OpenShift Container Platform, and helps you install a basic application. This guide is not suitable for deploying or installing a production environment of OpenShift.

Prerequisites

To install OpenShift Container Platform, you will need:

  • At least two physical or virtual RHEL 7+ machines, with fully qualified domain names (either real world or within a network) and password-less SSH access to each other. This guide uses master.openshift.example.com and node.openshift.example.com. These machines must be able to ping each other using these domain names.

  • A valid Red Hat subscription.

  • Wildcard DNS resolution that resolves your domain to the IP of the node. So, an entry like the following in your DNS server:

master.openshift.example.com. 300 IN A <IP of the master>
node.openshift.example.com. 300 IN A <IP of the node>
*.apps.openshift.example.com. 300 IN A <IP of the node>
Why the apps in your domain name for the wildcard entry?

When using OpenShift Container Platform to deploy applications, an internal router needs to proxy incoming requests to the corresponding application pod. By using apps as part of the application domains, the application traffic is accurately marked to the right pod.

You can use anything other than apps.

*.cloudapps.openshift.example.com. 300 IN A <IP of the node>

Once these are configured, use the following steps to set up a two-machine OpenShift Container Platform install.

Attach OpenShift Container Platform Subscription

  1. As root on the target machines (both master and node), use subscription-manager to register the systems with Red Hat.

    $ subscription-manager register
  2. List the available subscriptions.

    $ subscription-manager list --available
  3. Find the pool ID that provides OpenShift Container Platform subscription and attach it.

    $ subscription-manager attach --pool=<pool_id>
  4. Replace the string <pool_id> with the pool ID of the pool that provides OpenShift Container Platform. The pool ID is a long alphanumeric string.

These RHEL systems are now authorized to install OpenShift Container Platform. Now you need to tell the systems from where to get OpenShift Container Platform.

Set Up Repositories

On both master and node, use subscription-manager to enable the repositories that are necessary in order to install OpenShift Container Platform. You may have already enabled the first two repositories in this example.

$ subscription-manager repos --enable="rhel-7-server-rpms" --enable="rhel-7-server-extras-rpms" --enable="rhel-7-server-ose-3.6-rpms" --enable="rhel-7-fast-datapath-rpms"

The previous command is for OpenShift Container Platform 3.6. If you are using OpenShift Container Platform 3.5 use rhel-7-server-ose-3.5-rpms. If you are using OpenShift Container Platform 3.4 use rhel-7-server-ose-3.4-rpms.

This command tells your RHEL system that the tools required to install OpenShift Container Platform will be available from these repositories. Now we need the OpenShift Container Platform installer that is based on Ansible.

Install the OpenShift Container Platform Package

The installer for OpenShift Container Platform is provided by the atomic-openshift-utils package. Install it using yum on both the master and the node, after running yum update.

$ yum -y install wget git net-tools bind-utils iptables-services bridge-utils bash-completion kexec-tools sos psacct
$ yum -y update
$ yum -y install atomic-openshift-utils
$ yum -y install atomic-openshift-excluder atomic-openshift-docker-excluder
$ atomic-openshift-excluder unexclude
$ yum -y install docker-1.12.6

Set up Password-less SSH Access

Before running the installer on the master, set up password-less SSH access as this is required by the installer to gain access to the machines. On the master, run the following command.

$ ssh-keygen

Follow the prompts and just hit enter when asked for pass phrase.

for host in master.openshift.example.com node.openshift.example.com; do
ssh-copy-id -i ~/.ssh/id_rsa.pub $host; done

Run the Installer

Run the installer on the master.

$ atomic-openshift-installer install

This is an interactive install process that guides you through the various steps. In most cases, you want the default options. When it starts, select the option for OpenShift Container Platform. You are installing one master and one node and the domain name is the FQDN as mentioned at the start of this section, master.openshift.example.com and node.openshift.example.com.

At the step where the installer asks you for the FQDN for the routes, you must use apps.openshift.example.com, or cloudapps.openshift.example.com as discussed earlier, and NOT openshift.example.com. If you make an error, you can edit the /etc/origin/master/master-config.yaml at the end of the install process and make this change yourself by looking for the subdomain entry.

This install process takes approximately 5-10 minutes.

Start OpenShift Container Platform

After a successful install, use the following command to start OpenShift Container Platform.

# systemctl restart atomic-openshift-master-api atomic-openshift-master-controllers

Run the following command to verify that OpenShift Container Platform was installed and started successfully. You will get a listing of the master and node, in the Ready status.

oc get nodes

Once installed and started, before you add a new project, you need to set up basic authentication, user access, and routes.

Interact with OpenShift Container Platform

OpenShift Container Platform provides two command line utilities to interact with it.

  • oc: for normal project and application management

  • oc adm: for administrative tasks

    When running oc adm commands, you should run them only from the first master listed in the Ansible host inventory file, by default /etc/ansible/hosts.

Use oc --help and oc adm --help to view all available options.

In addition, you can use the web console to manage projects and applications. The web console is available at https://<master-fqdn>:8443/console. In the next section, you will see how to create user accounts for accessing the console.

You can interact with your OpenShift Container Platform instance from a remote system as well, using these command line utilities. Bundled as the OpenShift CLI, you can download these utilities for Windows, Mac, or Linux environments here.

Understand Roles and Authentication

By default, when installed for the first time, there are no roles or user accounts created in OpenShift Container Platform, so you need to create them. You have the option to either create new roles or define a policy that allows anyone to log in (to start you off).

Before you do anything else, log in at least one time with the default system:admin user, on the master run the following command.

$ oc login -u system:admin
All commands from now on should be executed on the master, unless otherwise indicated.

By logging in at least one time with this account, you will create the system:admin user’s configuration file, which will allow you to log in subsequently.

There is no password for this system account.

To continue configuring your basic OpenShift Container Platform environment, follow the steps outlined in Configure OpenShift Container Platform.