Skip to main content

Command Palette

Search for a command to run...

How to Install OpenShift 4.14 with the UPI Method

Updated
10 min read
How to Install OpenShift 4.14 with the UPI Method

Apa itu Openshift?

Red Hat OpenShift adalah platform Kubernetes enterprise. Intinya Kubernetes, tapi ditambah komponen built-in (security, registry, networking, observability, operator lifecycle, dsb.) supaya deploy & kelola aplikasi container jadi standar, aman, dan otomatis.

Ada 2 varian:

  • OpenShift Container Platform (OCP): komersial, support Red Hat.

  • OKD: edisi komunitas (upstream dari OCP).

Methode Installasi

  1. IPI — Installer-Provisioned Infrastructure

    Installer OpenShift yang sekalian membangun infrastrukturnya (VM/instances, jaringan, load balancer, DNS) di platform yang didukung (mis. AWS, Azure, GCP, vSphere, bare-metal IPI).

  2. UPI (User-Provisioned Infrastructure)

    Kamu yang menyiapkan seluruh infrastruktur (VM/bare-metal, jaringan, load balancer, DNS, storage). Installer hanya membuat manifests dan berkas ignition untuk dipasang ke node.

  3. Agent-Based

    Metode instal OpenShift yang pakai discovery ISO berisi “agent”. Kamu siapkan 2 file:

    • install-config.yaml → setting level cluster (baseDomain, nama cluster, jaringan cluster/service/machine, pullSecret, sshKey, proxy/mirror).

    • agent-config.yaml → detail host (MAC NIC, IP statik via NMState), rendezvousIP, apiVIP/ingressVIP.

Agent di tiap host akan auto-discover, validasi resource, lalu jalanin instalasi tanpa kamu harus provisioning infra via installer (beda dengan IPI).

Pre-Install

1. Minimum VM Cluster Resources

MachineOSCPURAMStorage
BastionRHEL 93 VCPU8 GB50 GB
BootstrapRHCOS4 VCPU16 GB100 GB
Control PlaneRHCOS4 VCPU16 GB100 GB
ComputeRHCOS or RHEL2 VCPU8 GB100 GB

1. ### Konfigurasi Port dan Firewall untuk OpenShift

Sebelum melakukan instalasi OpenShift, pastikan semua port yang dibutuhkan sudah terbuka di setiap node — baik antar node (all-machine), antara node dengan control plane, maupun antar control plane itu sendiri.

Port-port ini digunakan untuk komunikasi internal OpenShift, seperti sinkronisasi kubelet, akses API server, dan trafik overlay network (VXLAN/Geneve).

Jika port-port berikut ditutup oleh firewall, proses instalasi dapat gagal, atau cluster yang sudah jalan bisa mengalami gangguan komunikasi antar node.

### 1. All-machine to All-machine Communication

Port di bawah ini wajib dibuka di semua node (master, worker, bootstrap, dan bastion) agar komunikasi internal OpenShift berjalan lancar:

| Protocol | Port | Deskripsi | | --- | --- | --- | | ICMP | N/A | Digunakan untuk uji konektivitas antar node (ping) | | TCP | 1936 | Endpoint metrics internal | | 9000-9999 | Layanan internal host, termasuk node exporter (9100-9101) dan Cluster Version Operator (9099) | | | 10250-10259 | Port default yang digunakan oleh kubelet dan komponen Kubernetes lainnya | | | 10256 | Port internal untuk openshift-sdn | | | UDP | 4789 | VXLAN overlay network | | 6081 | Geneve overlay network | | | 9000-9999 | Host-level metrics dan monitoring service | | | 500 | IPsec IKE (Internet Key Exchange) packets | | | 4500 | IPsec NAT-Traversal packets | | | 123 | NTP (Network Time Protocol) – sinkronisasi waktu antar node | | | TCP/UDP | 30000-32767 | NodePort service (port untuk akses aplikasi eksternal) | | ESP | N/A | IPsec Encapsulating Security Payload (ESP) |

### 2. All-machine to Control Plane Communication

Port berikut harus dibuka agar setiap node (termasuk worker) bisa berkomunikasi dengan control plane:

| Protocol | Port | Deskripsi | | --- | --- | --- | | TCP | 6443 | Akses ke Kubernetes API Server |

\> Semua node, termasuk bootstrap dan worker, harus bisa mengakses port 6443 pada masing-masing master node.
\> Ini adalah jalur utama komunikasi kubelet dengan API server.

### 3. Control Plane to Control Plane Communication

Port di bawah ini digunakan untuk komunikasi antar master node (etcd cluster):

| Protocol | Port | Deskripsi | | --- | --- | --- | | TCP | 2379-2380 | Komunikasi internal dan sinkronisasi data antar komponen etcd |

\> Pastikan hanya node master yang membuka port ini antar sesama master, karena etcd adalah komponen sensitif dan menyimpan seluruh data cluster.

berikut commnad untuk open port

# ==========================
# OpenShift Core & Kubernetes
# ==========================
sudo firewall-cmd --permanent --add-port=6443/tcp        # API Server
sudo firewall-cmd --permanent --add-port=2379-2380/tcp   # etcd (control plane)
sudo firewall-cmd --permanent --add-port=10250-10259/tcp # kubelet & node services
sudo firewall-cmd --permanent --add-port=10256/tcp       # openshift-sdn
sudo firewall-cmd --permanent --add-port=1936/tcp        # metrics
sudo firewall-cmd --permanent --add-port=9000-9999/tcp   # node exporter & internal services
sudo firewall-cmd --permanent --add-port=9000-9999/udp   # node exporter (udp range)
sudo firewall-cmd --permanent --add-port=30000-32767/tcp # NodePort range
sudo firewall-cmd --permanent --add-port=30000-32767/udp # NodePort range

# ==========================
# Networking & Overlay
# ==========================
sudo firewall-cmd --permanent --add-port=4789/udp        # VXLAN
sudo firewall-cmd --permanent --add-port=6081/udp        # Geneve
sudo firewall-cmd --permanent --add-port=500/udp         # IPsec IKE
sudo firewall-cmd --permanent --add-port=4500/udp        # IPsec NAT-T
sudo firewall-cmd --permanent --add-protocol=esp         # IPsec ESP
sudo firewall-cmd --permanent --add-port=123/udp         # NTP
sudo firewall-cmd --permanent --add-port=53/tcp          # DNS
sudo firewall-cmd --permanent --add-port=53/udp          # DNS

# ==========================
# HTTP / HTTPS Access (Route / Web Console)
# ==========================
sudo firewall-cmd --permanent --add-port=80/tcp          # HTTP
sudo firewall-cmd --permanent --add-port=8080/tcp        # Alternate HTTP
sudo firewall-cmd --permanent --add-port=443/tcp         # HTTPS

# ==========================
# Reload firewall
# ==========================
sudo firewall-cmd --reload
sudo firewall-cmd --list-ports

4. Setup SSH

ssh-keygen -t ed25519
eval "$(ssh-agent -s)”
ssh-add ~/.ssh/id_ed25519

Step Install OCP with UPI Method

1. Install Dependecies

dnf update
dnf install chrony dnsmasq haproxy httpd
systemctl enable --now chronyd dnsmasq httpd haproxy
timedatectl set-ntp true
timedatectl

selain dependecies diatas juga kita perlu install package openshiftnya, bisa cari untuk linknya ada di package, sesuaikan dengan versi yang akan diinstall untuk lab kali ini kita menggunakan versi 4.14.34

wget https://mirror.openshift.com/pub/openshift-v4/x86_64/clients/ocp/4.14.34/openshift-install-linux.tar.gz
wget https://mirror.openshift.com/pub/openshift-v4/x86_64/clients/ocp/4.14.34/openshift-client-linux.tar.gz
tar -xzvf openshift-client-linux.tar.gz
tar -xzvf openshift-install-linux.tar.gz
mv kubectl oc openshift-install /usr/bin/

2. Setting DNS

untuk menginstall ocp kita perlu setting DNS, untuk dns yang kita gunakan kali ini menggunakan dnsmasq

ip a
vim /etc/dnsmasq.conf

untukk isinya bisa menggunakan format ini namun perlu diganti pada beberapa bagian seperti interface,domain,local domain,dan ipnya.

## edit pada /etc/dnsmasq.conf 
user=dnsmasq
group=dnsmasq
interface=ens192 ## --> sesuaikan dengan interface
bind-interfaces
conf-dir=/etc/dnsmasq.d,.rpmnew,.rpmsave,.rpmorig
no-hosts
addn-hosts=/etc/hosts
domain=ocp.bayhaqqy.lab ## --> ganti nama domainnya
local=/ocp.bayhaqqy.lab/ ## --> ganti nama domainnya
server=192.168.1.10 #external --> External
server=8.8.8.8 #upstream
server=10.10.103.31 #internal --> ip bastion
address=/apps.ocp.bayhaqqy.lab/10.10.103.31 # --> sesuaikan dengan domainnya

3. Setting Haproxy

karena kita akan menginstall cluster HA maka kita perlu setting Haproxy sebagai load balancer

vim etc/haproxy/haproxy.conf/
systemctl restart haproxy

untuk settingan haproxy bisa ikuti dibawah ini, tinggal disesuaikan aja hostnamenya

## isi etc/haproxy/haproxy.conf/
#---------------------------------------------------------------------
# Example configuration for a possible web application.  See the
# full configuration options online.
#
#   https://www.haproxy.org/download/1.8/doc/configuration.txt
#
#---------------------------------------------------------------------

#---------------------------------------------------------------------
# Global settings
#---------------------------------------------------------------------
global
    # to have these messages end up in /var/log/haproxy.log you will
    # need to:
    #
    # 1) configure syslog to accept network log events.  This is done
    #    by adding the '-r' option to the SYSLOGD_OPTIONS in
    #    /etc/sysconfig/syslog
    #
    # 2) configure local2 events to go to the /var/log/haproxy.log
    #   file. A line like the following can be added to
    #   /etc/sysconfig/syslog
    #
    #    local2.*                       /var/log/haproxy.log
    #
    log         127.0.0.1 local2

    chroot      /var/lib/haproxy
    pidfile     /var/run/haproxy.pid
    maxconn     4000
    user        haproxy
    group       haproxy
    daemon

    # turn on stats unix socket
    stats socket /var/lib/haproxy/stats

    # utilize system-wide crypto-policies
    ssl-default-bind-ciphers PROFILE=SYSTEM
    ssl-default-server-ciphers PROFILE=SYSTEM

#---------------------------------------------------------------------
# common defaults that all the 'listen' and 'backend' sections will
# use if not designated in their block
#---------------------------------------------------------------------
defaults
    mode                    tcp
    log                     global
#   option                  httplog
    option                  dontlognull
    option http-server-close
#   option forwardfor       except 127.0.0.0/8
    option                  redispatch
    retries                 3
    timeout http-request    10s
    timeout queue           1m
    timeout connect         10s
    timeout client          1m
    timeout server          1m
    timeout http-keep-alive 10s
    timeout check           10s
    maxconn                 3000

#---------------------------------------------------------------------
# round robin balancing between the various backends
#---------------------------------------------------------------------

frontend main6443
bind *:6443
default_backend api6443

backend api6443
balance source
mode tcp
server bootstrap.ocp.bayhaqqy.lab bootstrap.ocp.bayhaqqy.lab:6443 check
server master00.ocp.bayhaqqy.lab master00.ocp.bayhaqqy.lab:6443 check
server master01.ocp.bayhaqqy.lab master01.ocp.bayhaqqy.lab:6443 check
server master02.ocp.bayhaqqy.lab master02.ocp.bayhaqqy.lab:6443 check

frontend main22623
bind *:22623
default_backend api22623

backend api22623
balance source
mode tcp
server bootstrap.ocp.bayhaqqy.lab bootstrap.ocp.bayhaqqy.lab:22623 check  
server master00.ocp.bayhaqqy.lab master00.ocp.bayhaqqy.lab:22623 check     
server master01.ocp.bayhaqqy.lab master01.ocp.bayhaqqy.lab:22623 check
server master02.ocp.bayhaqqy.lab master02.ocp.bayhaqqy.lab:22623 check

frontend main443
bind *:443
default_backend router443

backend router443
balance source
mode tcp
server worker00.ocp.bayhaqqy.lab worker00.ocp.bayhaqqy.lab:443 check
server worker01.ocp.bayhaqqy.lab worker01.ocp.bayhaqqy.lab:443 check

frontend main80
bind *:80
default_backend router80

backend router80
balance source
mode tcp
server worker00.ocp.bayhaqqy.lab worker00.ocp.bayhaqqy.lab:80 check
server worker01.ocp.bayhaqqy.lab worker01.ocp.bayhaqqy.lab:80 check

perlu diperhatikan pada domainnya, seusaikan dengan domain yang akan digunakan untuk cluster ocp

4. Setting /etc/hosts

karena kita menggunakan bastion sebagai dns servernya kita juga harus setting domainnya pada /etc/hosts, pastikan semua record harus dimasukkan pada /etc/hosts agar tidak ada masalah pada koneksi

vim /etc/hosts

tambahkan semua record node ocp ke /etc/host dan pastikan bisa di nslookup, jika semua bisa di nslookup berarti untuk hostname sudah bisa kita gunakan untuk node ocp yang akan kita install

## isi /etc/hosts
#bastion
10.10.103.31 bastion.ocp.bayhaqqy.lab
#bootstrap
10.10.103.32 bootstrap.ocp.bayhaqqy.lab bootstrap
#master
10.10.103.33 master00.ocp.bayhaqqy.lab master00
10.10.103.34 master01.ocp.bayhaqqy.lab master01
10.10.103.35 master02.ocp.bayhaqqy.lab master02
#worker
10.10.103.36  worker00.ocp.bayhaqqy.lab worker00
10.10.103.37  worker01.ocp.bayhaqqy.lab worker01
#api
10.10.103.31 api-int.ocp.bayhaqqy.lab
10.10.103.31 api.ocp.bayhaqqy.lab
#ocp
10.10.103.31 console-openshift-console.apps.ocp.bayhaqqy.lab
10.10.103.31 oauth-openshift.apps.ocp.bayhaqqy.lab
10.10.103.31 default-route-openshift-image-registry.apps.ocp.bayhaqqy.lab

perlu perhatikan pada domainnya bisa disesuaikan dengan domain dan ip yang akan digunakan cluster

5. Create YAML Installation

untuk pull secretnya bisa salin di pull-secret, nanti mauskkan pada install-config.yaml nya.

mkdir yaml-collection
mkdir ocp4
vim yaml-collection/install-config.yaml
cat .ssh/id_ed25519.pub

untuk install-config.yamlnya bisa ikuti seperti dibawah ini tinggal sesuaikan pada baseDomain, nama cluster,pullSecret dan sshKeynya.

## isi install-confignya
apiVersion: v1
baseDomain: bayhaqqy.lab # --> sesuaikan dengan domainnya
compute:
- hyperthreading: Enabled
  name: worker
  replicas: 0
controlPlane:
  hyperthreading: Enabled
  name: master
  replicas: 3
metadata:
  name: ocp # --> sesuaikan dengan nama clusternya
networking:
  clusterNetwork:
  - cidr: 10.128.0.0/14
    hostPrefix: 23
  networkType: OVNKubernetes
  serviceNetwork:
  - 172.30.0.0/16
platform:
  none: {}
fips: false
pullSecret: 'masukkan pull secretnya'
sshKey: 'masukkan ssh pubkeynya'

Folder yang saat ini digunakan hanya untuk menyimpan file install-config.yaml.
Jika ada perubahan konfigurasi, lakukan langsung di folder ini. Setelah proses instalasi dimulai, file manifest akan otomatis dibuat di folder baru yang terpisah — folder tersebut nantinya digunakan sebagai lokasi file manifest hasil instalasi, sekaligus sebagai backup dari proses instalasi.

cp yaml-collection/install-config.yaml ocp4/
openshift-install create manifests --dir ocp4/
vim ocp4/auth/cluster-scheduler-02-config.yml
openshift-install create ignition-configs --dir ocp4/
## ganti pada ocp4/auth/cluster-scheduler-02-config.yml
apiVersion: config.openshift.io/v1
kind: Scheduler
metadata:
  creationTimestamp: null
  name: cluster
spec:
  mastersSchedulable: false # --> dari true menjadi false
  policy:
    name: ""
status: {}

6. Upload Ignition

nah karena untuk port default pada httpd masih 80, kita perlu ganti dulu ke 8080 agar tidak menabrak port 80 yang akan digunakan oleh cluster

semanage port -a -t http_port_t -p tcp 8080
vim /etc/httpd/conf/httpd.conf

## cari pada listen 80
Listen 80 # --> rubah menjadi 8080 

systemctl restart httpd
cp ocp4/*.ign /var/www/html/
chmod -R 777 /var/www/html
chcon -R -t httpd_sys_content_t /var/www/html/

7. Deploy

  1. Bootstrap

jalankan vm bootstrap yang sudah menggunakan iso RHCOS

sudo nmtui

sesuaikan untuk ipnya menggunakan ip bootstrap yang sudah di define pada /etc/hosts bastion, dan gunakan dns servernya ke ip bastion. kalau sudah bisa coba untuk nslookup terlebih dahulu ke bastion, setelah itu baru download ignition config yang berada pada bastion

sudo coreos-installer install --copy-network --insecure-ignition --ignition-utl http://ipbastion:8080/bootstrap.ign /dev/sda
reboot

pada sisi vm bastion jalankan command di bawah ini

openshift-install --dir=/root/ocp4 wait-for bootstrap-complete --log-level=debug
  1. Master

jalan vm untuk node master dan bisa atur network seperti diatas dengan ip yang sudah disetting pada node bastion dan jalankan command berikut

sudo coreos-installer install --copy-network --insecure-ignition --ignition-url http://ipbastion:8080/master.ign /dev/sda
reboot

tunggu hingga status bootstrap seperti di bawah ini, setelah itu node master sudah bisa direboot untuk memulai instalasi node master

jika node master sudah menyala kita bisa export kubeconfig agar bisa manage cluster ocp, lalu bisa watch oc get node untuk melihat status node cluster, jika masih NotReady tunggu hingga 30 menit sampai status node menjadi Ready

mkdir .kube
cp ocp4/auth/kubeconfig /root/.kube/config
export KUBECONFIG=/root/.kube/config
watch oc get node
  1. Worker

jalan vm untuk node master dan bisa atur network seperti diatas dengan ip yang sudah disetting pada node bastion dan jalankan command berikut

sudo coreos-installer install --copy-network --insecure-ignition --ignition-utl http://ipbastion:8080/worker.ign /dev/sda
reboot

tunggu hingga status node master menjadi Ready, jika sudah Ready node worker bisa direboot untuk memulai instalasi

jika node worker sudah dinyalakan bisa lanjutkan pada node bastion untuk memonitoring hingga semua node menjadi Ready

watch oc get node,co,mcp
watch -n2 'oc get csr -o json | jq -r ".items[] | select(.status.conditions|not) | .metadata.name" | xargs -r oc adm certificate approve'

jika sudah 10 menit dan node worker tidak masuk dalam list node bisa reboot node worker, lalu tunggu hingga semua operator dan node clear semua, proses ini bisa memakan waktu 30-1 jam tergantung dari jaringan

jika operator dan node sudah aman semua, kita bisa coba untuk akses consolenya namun sebelum itu kita perlu hardcode domain ocp kedalam laptop kita, kalo menggunakan windows biasanya ada di C:\Windows\System32\drivers\etc, untuk domain ocpnya bisa dicek pada /etc/hosts

lalu kita bisa coba untuk mengakses consolenya

oc whoami --show-console
cat ocp4/auth/kubeadmin-password

login menggunakan user kubeadmin dan passwordnya yang ada di kubeadmin-password

jika berhasil maka kita masuk kedalam dashboard ocp dan proses instalasi kita sudah selesai, dan untuk node bootstrap bisa dimatikan dan dihapus jika proses instalasi sudah berhasil