Red Hat OpenShiftEnterpriseSelf-Hosted
This guide will walk you through the process of installing Okteto on a Red Hat OpenShift cluster.
Red Hat OpenShift adds security restrictions on top of Kubernetes, so installing Okteto takes a few extra steps. This guide covers them, and you can talk to us for help during the installation.
Installation Requirements
Before you begin, make sure you have the following command-line interfaces (CLIs) installed on your machine:
okteto>= 3.25.0 (installation guide)helm>= 3.14 (installation guide)oc>= 4.0.0
You also need:
- An Okteto license
- A Kubernetes cluster with Red Hat OpenShift (≥ 4.0.0) installed
You also need these values:
<openshift-base-domain>: for example,okteto.r9yz.p2.openshiftapps.com<openshift-cluster-name>: for example,okteto
Getting your Okteto License
You need a license to install Okteto. If you have an Okteto subscription, your license key came with it, and support can send it again if you can't find it.
Preparing your cluster for Okteto installation
Before installing Okteto, prepare your Red Hat OpenShift cluster by following these steps.
Create the okteto namespace
Run the following command to create the okteto namespace:
oc create namespace okteto
Allow containers as root in the okteto namespace
Red Hat OpenShift doesn't allow containers to run as root by default, and some components of the Okteto control plane require root privileges.
To allow root containers for those components, run:
oc adm policy add-scc-to-user anyuid -z default -n okteto
oc adm policy add-scc-to-user anyuid -z okteto -n okteto
oc adm policy add-scc-to-user anyuid -z okteto-buildkit -n okteto
oc adm policy add-scc-to-user anyuid -z okteto-registry -n okteto
These commands grant the anyuid Security Context Constraint (SCC) to those service accounts in the okteto namespace, so they can run containers as root.
Grant access to the "privileged" SCC for the Okteto Build service account
Red Hat OpenShift doesn't allow privileged containers by default, and the Okteto Build Service needs them. To grant privileged access to its service account, run:
oc adm policy add-scc-to-user privileged -z okteto-buildkit -n okteto
This command grants the privileged SCC to the okteto-buildkit service account in the okteto namespace.
Grant access to the host to the Okteto Daemon service account
Red Hat OpenShift restricts access to the host by default, and the Okteto Daemon needs it. To grant the permissions to the Okteto Daemon, run:
oc adm policy add-scc-to-user hostaccess -z okteto -n okteto
This command grants the hostaccess SCC to the okteto service account in the okteto namespace.
Copy Red Hat OpenShift wildcard certificate to the okteto namespace
Red Hat OpenShift requires a wildcard certificate for the wildcard domain *.apps.<openshift-base-domain>.
We recommend reusing it for Okteto, to expose secure and unique endpoints for your application environments.
By default, Red Hat OpenShift creates the wildcard certificate in the secret <openshift-cluster-name>-primary-cert-bundle-secret of the openshift-ingress namespace.
In that case, copy the certificate to the okteto namespace:
kubectl get secret <openshift-cluster-name>-primary-cert-bundle-secret -n openshift-ingress -o yaml | sed 's/namespace: openshift-ingress/namespace: okteto/' | kubectl apply -f -
If you installed OpenShift with a custom certificate, copy the certificate's secret (and CA if needed) to the okteto namespace.
This guide explains how to configure a custom certificate and CA in Okteto.
Retrieve the Red Hat OpenShift Ingress Controller IP
We recommend installing Okteto behind the Red Hat OpenShift Ingress Controller. Get the IP address of your Red Hat OpenShift Ingress Controller:
kubectl get svc router-default -n openshift-ingress -o jsonpath='{.status.loadBalancer.ingress[0].ip}'
Store this value as <ingress-controller-ip>; you'll use it in the Okteto Helm configuration.
Installing Okteto
Argo CD installs the same Helm chart declaratively. See Configure Argo CD for the Application manifest, sync policy, and the ignoreDifferences Okteto requires.
It replaces Add the Okteto Helm repository and Installing the Okteto Helm chart. Every other step on this page still applies, including the DNS record and the sign-in.
You install Okteto with its Helm chart.
Add the Okteto Helm repository
Add the Okteto Helm repository and update it:
helm repo add okteto https://charts.okteto.com
helm repo update
Create the Helm configuration file
Create a configuration file named config.yaml with the following content.
Replace <okteto-license>, <openshift-base-domain>, <openshift-cluster-name>, and <ingress-controller-ip> with your actual values:
license: <okteto-license>
openshift:
enabled: true
subdomain: apps.<openshift-base-domain>
wildcardCertificate:
create: false
name: <openshift-cluster-name>-primary-cert-bundle-secret
ingress-nginx:
enabled: false
okteto-nginx:
enabled: false
ingress:
oktetoIngressClass: openshift-default
class: openshift-default
forceIngressClass: true
ip: <ingress-controller-ip>
cluster:
endpoint: https://api.<openshift-base-domain>:6443
user:
extraRoleBindings:
enabled: true
roleBindings:
okteto:
- system:openshift:scc:anyuid
The extraRoleBindings section lets your developers use images that require root privileges in their application environments.
This is the minimum configuration. The Helm configuration lists every setting.
Installing the Okteto Helm chart
Install the Okteto Helm chart:
helm upgrade --install okteto okteto/okteto -f config.yaml --namespace=okteto --version=1.50.0
This command installs Okteto in the okteto namespace using the configuration specified in config.yaml.
After a few seconds, Helm creates all the resources. The output looks like this:
Release "okteto" has been installed. Happy Helming!
NAME: okteto
LAST DEPLOYED: Thu Mar 26 18:07:55 2020
NAMESPACE: okteto
STATUS: deployed
Sign in to your Okteto instance
Once the installation finishes, your Okteto instance is available at https://okteto.apps.<openshift-base-domain>.
Okteto creates your account the first time you log in, and the first user to log in gets the Admin role.
Deploy your first app
With your Okteto instance running, install the Okteto CLI and configure it with the URL of your instance, https://okteto.apps.<openshift-base-domain>. Then deploy your first app.