Questo contenuto non è disponibile nella lingua selezionata.
Chapter 3. Configure OpenShift Container Platform
3.1. Overview Copia collegamentoCollegamento copiato negli appunti!
This guide introduces you to the basic concepts of OpenShift Container Platform, and helps you configure a basic application. This guide provides the configuration steps following the installation of a basic OpenShift Container Platform environment, and is not suitable for deploying or installing a production environment of OpenShift.
3.2. Change Log In Identity Provider Copia collegamentoCollegamento copiato negli appunti!
The default behavior of a freshly installed OpenShift Container Platform instance is to deny any user from logging in. To change the authentication method to HTPasswd:
- Open the /etc/origin/master/master-config.yaml file in edit mode.
-
Find the
identityProviders
section. -
Change
DenyAllPasswordIdentityProvider
toHTPasswdPasswordIdentityProvider
provider. Change the value of the name label to
htpasswd_auth
and add a new linefile: /etc/origin/master/htpasswd
in the provider section.An example
identityProviders
section withHTPasswdPasswordIdentityProvider
would look like the following.Copy to Clipboard Copied! Toggle word wrap Toggle overflow - Save the file.
3.3. Create User Accounts Copia collegamentoCollegamento copiato negli appunti!
Now that you are using the HTPasswdPasswordIdentityProvider
provider, you need to generate these user accounts.
You can use the httpd-tools package to obtain the htpasswd binary that can generate these accounts.
yum -y install httpd-tools
# yum -y install httpd-tools
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Create a user account.
touch /etc/origin/master/htpasswd
# touch /etc/origin/master/htpasswd
Copy to Clipboard Copied! Toggle word wrap Toggle overflow htpasswd -b /etc/origin/master/htpasswd admin redhat
# htpasswd -b /etc/origin/master/htpasswd admin redhat
Copy to Clipboard Copied! Toggle word wrap Toggle overflow You have created a user,
admin
, with the password,redhat
.Restart OpenShift before going forward.
master-restart api
# master-restart api
Copy to Clipboard Copied! Toggle word wrap Toggle overflow master-restart controllers
# master-restart controllers
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Give this user account
cluster-admin
privileges, which allows it to do everything.oc adm policy add-cluster-role-to-user cluster-admin admin
$ oc adm policy add-cluster-role-to-user cluster-admin admin
Copy to Clipboard Copied! Toggle word wrap Toggle overflow 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.You can use this username/password combination to log in via the web console or the command line. To test this, run the following command.
oc login -u admin
$ oc login -u admin
Copy to Clipboard Copied! Toggle word wrap Toggle overflow
Before going forward, change to the default
project.
oc project default
$ oc project default
For more details, see roles and authentication.
3.4. Deploy the OpenShift Router Copia collegamentoCollegamento copiato negli appunti!
The OpenShift router is the entry point for external network traffic destined for OpenShift services. It supports HTTP, HTTPS, and any TLS-enabled traffic that uses SNI, which enables the router to send traffic to the correct service.
Without the router, OpenShift services and pods are unable to communicate with any resource outside of the OpenShift instance.
The installer creates a default router.
Delete the default router using the following command.
oc delete all -l router=router
$ oc delete all -l router=router
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Create a new default router.
oc adm router --replicas=1 --service-account=router
$ oc adm router --replicas=1 --service-account=router
Copy to Clipboard Copied! Toggle word wrap Toggle overflow
The OpenShift documentation contains detailed information on Router Overview.
3.5. Deploy an Internal Registry Copia collegamentoCollegamento copiato negli appunti!
Openshift provides an internal, integrated container image registry that can be deployed to locally manage images. OpenShift uses the docker-registry to store, retrieve, and build container images, as well as deploy and manage them throughout their lifecycle.
The installer creates a default registry.