はじめに
本記事では、オンプレミスにてOpenShiftをSingle Node構成で構築し、Assisted Installerを利用して環境をセットアップした手順について記載します。
さらに、永続ストレージの提供基盤としてNetAppのTridentを導入し、バックエンドストレージにはONTAPを利用する構成を最終的には設定するといった内容になります。
コンテナ環境ではアプリケーションの可搬性が注目されがちですが、実運用ではストレージ連携も重要なポイントとなり、OpenShiftとNetApp ONTAP、そしてTridentを組み合わせることで、Kubernetesネイティブな形で柔軟にストレージを管理できるようになります。
特に本記事では、踏み台サーバ(RHEL9+DNS)及びOpenShiftの導入までについて記載します。
何をしたい?できる?
- Red Hat OpenShift Container Platform (OCP)の構築
- Single Node構成で構築
- 永続ストレージでNetApp Trident + ONTAPを利用
Red Hat OpenShift Container Platform(OCP)とは
OCPは、Kubernetesを基盤としたエンタープライズ向けのコンテナプラットフォームで、アプリケーションのコンテナ化からデプロイ、運用、スケーリングまでを統合的に管理できるのが特徴となります。
開発者はコンテナを利用してアプリケーションを迅速に開発・展開でき、運用者はGUIやCLIを通じてクラスタやリソースを効率的に管理できますし、セキュリティやCI/CD、監視機能などもあらかじめ統合されているので、企業の本番環境でも安心して利用できる基盤として広く採用されています。

記事における環境情報
本記事では、以下の環境で実施した内容となります。
OSやモジュールは以下の構成としています。
- ONTAP 9.17.1
- NetApp Trident 26.02.1
- Windows Server 2025 Hyper-V環境
- Red Hat Enterprise Linux 9.8
- OpenShift 4.21.16
設定手順
設定の流れとしては以下のような形になります。
1. 踏み台サーバとしてRHEL9の導入及びDNSサーバ設定
2. OpenShift用の Single Node仮想マシンを用意し Assist InstallでOpenshiftの導入
3. 踏み台サーバへOCコマンド導入やその他設定
本記事では社内機器で検証環境を構築するので、
組織の開発者向けに提供するRHEL for Business Developersという無償プログラムを利用する形になります。
(OpenShiftは60日間の評価版を利用となります)
1. 踏み台(CLI操作+DNSサーバ)となるLinux作成
Hyper-Vやそこで作成した仮想マシンでの作業を実施します。
1-1. RHEL for Business Developersを有効化
Red Hatのサイトでアカウントを作成し、サブスクリプションを有効化します。
1-2. RHELのImageをダウンロード
本記事ではRHEL9.8を利用するので ダウンロードサイト から、9.8用のDVDイメージをダウンロードします。
1-3. 踏み台サーバのInstall
Hyper-V上で仮想マシンの作成を実施し、ダウンロードしたISOイメージを使用してRHEL9.8のInstallを実施します。
後々、踏み台サーバ上でWebブラウザの操作を実施したいので、ソフトウェアの選択ではGUIを指定してのInstallを実施します。
SSHでログインを行い、Install情報を確認します。
本環境ではuser01というユーザで操作を実施しています。
> id
uid=1000(user01) gid=1000(user01) groups=1000(user01),10(wheel) context=unconfined_u:unconfined_r:unconfined_t:s0-s0:c0.c1023
> cat /etc/redhat-release
Red Hat Enterprise Linux release 9.8 (Plow)
1-4. RHELの登録し、パッケージをアップデート
踏み台サーバでRHELの登録を実施します。
> sudo rhc connect
Connecting ps-rh100.example.org to Red Hat.
This might take a few seconds.
Username: XXXXXX
Password: XXXXXX
● Connected to Red Hat Subscription Management
● Connected to Red Hat Insights
● Activated the Remote Host Configuration daemon
Successfully connected to Red Hat!
Manage your connected systems: https://red.ht/connector
インストール済みのパッケージをアップデートを実行します。
> sudo dnf update
サブスクリプション管理リポジトリーを更新しています。
Red Hat Enterprise Linux 9 for x86_64 - BaseOS (RPMs) 18 MB/s | 117 MB 00:06
Red Hat Enterprise Linux 9 for x86_64 - AppStream (RPMs) 19 MB/s | 95 MB 00:05
(中略)
kernel-5.14.0-687.10.1.el9_8.x86_64 kernel-core-5.14.0-687.10.1.el9_8.x86_64
kernel-modules-5.14.0-687.10.1.el9_8.x86_64 kernel-modules-core-5.14.0-687.10.1.el9_8.x86_64
完了しました!
1-5. XRDPの有効化
OpenShiftをGUIで管理する際に、踏み台にリモートデスクトップ接続を行ってWebブラウザを使用する為、XRDPを導入しRDP(リモートデスクトップ)によるアクセスができるようにします。
# GUI サーバパッケージグループをインストール
> sudo dnf groupinstall "Server with GUI" -y
サブスクリプション管理リポジトリーを更新しています。
(中略)
完了しました!
# 起動時のデフォルトターゲットをGUIに設定
> sudo systemctl set-default graphical.target
# EPEL (Extra Packages for Enterprise Linux) リポジトリ有効化
> sudo dnf -y install https://dl.fedoraproject.org/pub/epel/epel-release-latest-9.noarch.rpm
サブスクリプション管理リポジトリーを更新しています。
(中略)
完了しました!
# XRDP をインストール
> sudo dnf install xrdp -y
サブスクリプション管理リポジトリーを更新しています。
Extra Packages for Enterprise Linux 9 - x86_64 13 MB/s | 21 MB 00:01
(中略)
完了しました!
システム起動時にも自動でXRDPが起動されるように設定します。
> sudo systemctl start xrdp
> sudo systemctl enable xrdp
Created symlink /etc/systemd/system/multi-user.target.wants/xrdp.service → /usr/lib/systemd/system/xrdp.service.
RDP 接続できるように、3389/TCPをFiwareallで解放します。
# XDP用のPortの指定
> sudo firewall-cmd --permanent --add-port=3389/tcp
success
# 設定内容の再読み込み
> sudo firewall-cmd --reload
success.
# 設定状態の確認
> sudo firewall-cmd --list-ports --zone=public
3389/tcp
操作PCからリモートデスクトップを使用してアクセスを確認します。
1-6. 踏み台サーバ上にDNSサーバの構築
control Planeとcompute node 間で、互いのノード名やAPIサーバーを特定する際や、インストール時にもDNSレコードの登録が必要となる為、踏み台サーバ上にDNSサーバの構築を実施します。
(別途仮想マシンを作成して用意してもいいが、手間を省く為に踏み台上で作成)
本記事では踏み台サーバ上でdnsmasqインストールを行い、DNSサービスを構築します。
# dnsmasqインストールを実施
> sudo dnf install -y dnsmasq
サブスクリプション管理リポジトリーを更新しています。
(中略)
完了しました!
dnsmasq設定を実施します。
本記事ではDNSのドメインとしてexample.orgを使用し、Openshiftクラスタ名はocp100とします。
IP等の環境情報は以下の通りで、Single Node構成の為、同一IPに複数の役割を設定します。
| 名前 | IP | 役割 |
|---|---|---|
| ps-rh100.example.org | 10.11.100.44 | DNSサーバ+踏み台サーバ |
| master01.ocp100.example.org | 10.11.100.45 | OpenShift |
| api.ocp100.example.org | 10.11.100.45 | Kubernetes API |
| api-int.ocp100.example.org | 10.11.100.45 | Kubernetes API(内部通信) |
| .apps.ocp100.example.org | 10.11.100.45 | Ingress IP |
/etc/dnsmasq.confを以下のような形で作成します。
> sudo cat /etc/dnsmasq.conf
# ドメイン名を自動的にhostsに付与するか、/etc/hosts のエントリにドメイン追加が必要
expand-hosts
# 上位サーバに対して、プライベートIPアドレスの逆引き要求をしない
bogus-priv
# 上位DNSの設定ファイル
resolv-file=/etc/dnsmasq.resolv.conf
# DNS Server IP
listen-address=127.0.0.1,10.11.100.44
# Dnsmasq listen Port
port=53
# dnsmasqでCache Record
cache-size=150
# DNSクエリに対してのログを出力
log-queries
# ログの出力
log-facility=/var/log/dnsmasq.log
# カスタムドメインの追加
local=/example.org/
domain=example.org
# 正引き設定
address=/master01.ocp100.example.org/10.11.100.45
address=/api.ocp100.example.org/10.11.100.45
address=/api-int.ocp100.example.org/10.11.100.45
address=/.apps.ocp100.example.org/10.11.100.45
address=/ps-rh100.example.org/10.11.100.44
# 逆引き設定
ptr-record=45.100.11.10.in-addr.arpa,api.ocp100.example.org
ptr-record=45.100.11.10.in-addr.arpa,api-int.ocp100.example.org
ptr-record=45.100.11.10.in-addr.arpa,apps.ocp100.example.org
ptr-record=45.100.11.10.in-addr.arpa,master01.ocp100.example.org
ptr-record=44.100.11.10.in-addr.arpa,ps-rh100.example.org
システム起動時にも自動でDNSが起動されるように設定します。
> sudo systemctl start dnsmasq
> sudo systemctl enable dnsmasq
Created symlink /etc/systemd/system/multi-user.target.wants/dnsmasq.service → /usr/lib/systemd/system/dnsmasq.service.
/etc/resolv.confの修正を実施します。
> cat /etc/resolv.conf
# Generated by NetworkManager
search example.org
nameserver 127.0.0.1
nameserver 8.8.8.8
DNS参照ができるように、DNSをFiwareallで解放します。
# DNSの指定
> sudo firewall-cmd --add-service dns --permanent
success
# 設定内容の再読み込み
> sudo firewall-cmd --reload
success.
# 設定状態の確認
> sudo firewall-cmd --list-service --zone=public
cockpit dhcpv6-client dns ssh
NetworkManager.confで以下のdns=dnsmasqを追記します。
> cat /etc/NetworkManager/NetworkManager.conf
# Configuration file for NetworkManager.
(中略)
[main]
#plugins=keyfile,ifcfg-rh
dns=dnsmasq
(中略)
サービスを再起動します。
> sudo systemctl restart NetworkManager
/etc/resolv.confが以下のように変更している事を確認します。
> cat /etc/resolv.conf
# Generated by NetworkManager
search example.org
nameserver 127.0.0.1
options edns0 trust-ad
dnsmasq が自身のキャッシュにないドメインを解決するために、8.8.8.8 などの外部DNSへ問い合わせるよう設定を記載します。
> cat /etc/dnsmasq.resolv.conf
nameserver 8.8.8.8
名前解決が正しくできることを確認します。
# IPから名前を参照できる事の確認
> dig @10.11.100.44 +short -x 10.11.100.45
master01.ocp100.example.org.
apps.ocp100.example.org.
api-int.ocp100.example.org.
api.ocp100.example.org.
# 名前からIPを参照できる事の確認
> dig @10.11.100.44 +short api.ocp100.example.org
10.11.100.45
# 外部の名前からIPを参照できる事の確認
> dig @10.11.100.44 +short qiita.com
18.65.207.34
18.65.207.93
18.65.207.100
18.65.207.4
1-7. SSH公開鍵の作成
次項からのOpenShiftの導入において、踏み台サーバで作成したSSH公開鍵の登録を行う必要があるので
SSH公開鍵を作成します。
> ssh-keygen -t rsa -b 4096 -N ''
Generating public/private rsa key pair.
Enter file in which to save the key (/home/user01/.ssh/id_rsa):
Created directory '/home/user01/.ssh'.
Your identification has been saved in /home/user01/.ssh/id_rsa
Your public key has been saved in /home/user01/.ssh/id_rsa.pub
The key fingerprint is:
SHA256:0t4jkS5Wr7J2ADF/9QmD9KyEHmpfRUcjAocsKBY1kIU user01@ps-rh100.example.org
The key's randomart image is:
+---[RSA 4096]----+
| oB= ..++.o.+ |
|.E. = oo.=+o . |
|.. =o ..++ . |
| .o.+.+ o |
| o.o.S |
| . ..* + |
| +.+ + |
| .o..o . |
| ..+. |
+----[SHA256]-----+
公開鍵が作成されている事を確認します。
> pwd
/home/user01
> ls -al .ssh/
合計 12
drwx------. 2 user01 user01 38 5月 28 15:49 .
drwx------. 16 user01 user01 4096 5月 28 15:49 ..
-rw-------. 1 user01 user01 3401 5月 28 15:49 id_rsa
-rw-r--r--. 1 user01 user01 753 5月 28 15:49 id_rsa.pub
2. OpenShiftの導入
本記事ではOpenShiftのInstallについて、Red Hat Hybrid Cloud コンソールにログインしてAssisted Installerを使用して実施します。

2-1. Single Node用の仮想マシンの作成
要件に従って、以下のサイズの仮想マシンをHyper-V上で作成します。
(本記事ではStorageは大き目に作成しています)
| コンポーネント | 設定値 |
|---|---|
| CPU | 8 vCPU |
| Memory | 16G |
| Storaeg | 200G |
| MACアドレス | 00:15:5D:DD:DD:AA |
また、OpenShiftのAssisted Installerg画面でMACアドレスとIPの入力を行うので、作成した仮想マシンのMACアドレスを静的な形で作成します。
(Hyper-VでVM作成なので、ベンダーコードはマイクロソフトにしてます)

2-2. Assisted Installerへのアクセス
OpenShiftのインストールにあたってはRed Hat Hybrid Cloudで設定情報を入力し、
ISOファイルを作成してから、仮想マシンで作成したISOを接続して起動させる事で導入を進めるような形になります。
まずは、インターネット接続可能な作業用端末のブラウザからRed Hat Hybrid Cloud コンソールへアクセスを行います。
画面左側の[Resources]から[Assisted Installer]を選択して、表示された中央の画面で[Create Cluster]をクリックします。

2-3. Assisted InstallerでClusterの作成
本記事では、踏み台のDNSサーバはmaster01.ocp100.example.orgのような形でOpenShiftを登録しているので、Cluster名はocp100で、base domainはexample.orgと指定します。
また、OpenShiftのversionは4.21.16で進めます。
Number of control plane nodesを1のSingle Nodeを指定します。
また、本記事ではIPを固定で設定するので、Hosts' network configurationは[Static IP, bridges, and bonds]を選択し、画面下方の[Next]をクリックします。
Static network configurationsの画面で、踏み台兼DNSとして作成したサーバのIP、ネットワークセグメント、デフォルトゲートウェイの入力を実施します。
OpenShiftのSingle Nodeに設定するMACアドレスとIPを入力します。
(DNSに登録したIPと仮想マシン作成時に静的に指定したMACアドレスを入力)
Operatorsは特に何も指定せずに[Next]をクリックします。

Host discoveryでは[Add host]をクリックします。

表示された画面で、Provisioning typeはFull image Fileを選択します。
また、SSH public keyでは、[1-7. SSH公開鍵の作成]の踏み台サーバで作成したSSH公開鍵のコピーを実施し、[Generate Discovery ISO]をクリックします。

ダウンロードしたISOを用意しておいた仮想マシンに接続し、仮想マシンを起動します。

Assisted Installerの画面に戻り、起動した仮想マシンが認識している事を確認し、
[Next]をクリックします。

Storageの項目では特に何も操作せずに、[Next]をクリックします。

本記事ではNetworkingの項目で、Machine networkを10.X.X.Xの使用をする為、
[Use advanced networking]にチェックを入れて、Cluster network CIDRを192.168.0.0/16に変更します。
(Cluster network CIDRがデフォルトで使用する10.X.X.Xを変える)

Custom manifestsは特に指定せずに[Next]をクリックします。

Review and createの画面で、 preflight checksが通っている事を確認し、
画面下方の[Install cluster]をクリックします。


Install完了後に、踏み台サーバからOpenShiftを操作する為のkubeconfigのダウンロードと
初回でGUIアクセスを行い際に利用するkubeadminのパスワードをメモしておきます。
併せて、Web Console URLもメモしておきます。
3. OpenShiftの導入後作業
踏み台サーバからocコマンドで操作できるようにする為の設定等を実施します。
3-1 ocコマンドの導入
作業PCから踏み台サーバにリモートデスクトップ接続を実施し、ブラウザを起動します。

ブラウザからOpenShiftのInstall完了時に表示されていたWeb Console URLにアクセスします。
自己証明書環境なので、[危険を承知の上で使用]を選択してアクセスを続行します。

控えて置いたkubeadminでログインを行い、画面右上の[?]から[コマンドラインツール]を選択します。

表示された画面からOpenShift Command Line Interface (OC)のダウンロードを実施します。
本記事の環境では、踏み台サーバをRHEL9.8で作成しているので、[Download oc for Linux for x86_64 - RHEL 9]を使用します。
踏み台サーバのコンソールを立ち上げるかSSHで接続して、ダウンロードしたものを作業フォルダに移動させます。
> mkdir work
> mv ダウンロード/oc.rhel9.tar work/
> ls work/
oc.rhel9.tar
tarを展開します。
> cd work/
> tar -xvf oc.rhel9.tar
oc.rhel9
OpenShiftをInstall後にDownloadしておいたkubeconfigファイルを
踏み台サーバにSSH SCPなどを使ってアップロードしておきます。
> mkdir auth
> ls -l auth/
合計 12
-rw-r--r--. 1 user01 user01 12132 5月 28 18:37 kubeconfig
oc.rhel9だと使いにくいので、ocにRenameしてから、プログラム名だけで実行できるようにPATHを通します。
# Renameの実施
> ls -l
合計 273380
drwxr-xr-x. 2 user01 user01 24 5月 29 13:06 auth
-rwxr-xr-x. 1 user01 user01 139965608 4月 23 05:10 oc.rhel9
-rw-r--r--. 1 user01 user01 139970560 5月 29 12:52 oc.rhel9.tar
> mv oc.rhel9 oc
#$PATHの後に/home/user01/workを追加する
> cd
> pwd
/home/user01
> cat .bashrc
# .bashrc
# Source global definitions
if [ -f /etc/bashrc ]; then
. /etc/bashrc
fi
# User specific environment
if ! [[ "$PATH" =~ "$HOME/.local/bin:$HOME/bin:" ]]
then
PATH="$HOME/.local/bin:$HOME/bin:$PATH:/home/user01/work"
fi
export PATH
# Uncomment the following line if you don't like systemctl's auto-paging feature:
# export SYSTEMD_PAGER=
# User specific aliases and functions
if [ -d ~/.bashrc.d ]; then
for rc in ~/.bashrc.d/*; do
if [ -f "$rc" ]; then
. "$rc"
fi
done
fi
unset rc
ログインし直すとocのみでコマンドが実施できるようになります。
KUBECONFIG環境変数をセットして、ocコマンドでInstallしたOpenShiftの状態について確認します。
> export KUBECONFIG=${HOME}/work/auth/kubeconfig
> oc cluster-info
Kubernetes control plane is running at https://api.ocp100.example.org:6443
To further debug and diagnose cluster problems, use 'kubectl cluster-info dump'.
> oc get nodes
NAME STATUS ROLES AGE VERSION
master01.ocp100.example.org Ready control-plane,master,worker 35m v1.34.7
3-2 アイデンティティプロバイダー(IdP)設定
OpenShiftのGUIへkubeadminユーザでアクセスしていたかと思いますが、
GUIの上方に記載されているようにkubeadminユーザは一時的な管理ユーザとなる為、OAuth 設定を行います。
OpenShiftにおけるIdPは、クラスターへのアクセスユーザーを認証(IDとパスワードの検証)する外部システムまたはメカニズムで、OAuthサーバーと連携し、LDAP、OpenID Connect、htpasswdなどを用いてユーザーの信頼性を確認し、セキュアなアクセスを管理する役割を担います。
本記事では、テスト・小規模用のhtpasswd設定を実施します。
最初に、BASIC認証をかける時に必要な「.htpasswd」ファイルを作成します。
# htpasswdが利用できない場合は、事前にhttpd-toolsを導入します
> sudo dnf install httpd-tools
サブスクリプション管理リポジトリーを更新しています。
(中略)
完了しました!
# 指定するXXXXXX部分のPasswordは各自で設定してください
> pwd
/home/user01/work/auth
> htpasswd -c -B -b users.htpasswd ocadmin XXXXXX
Adding password for user ocadmin
> ls
kubeconfig users.htpasswd
htpasswdファイルが含まれるSecretオブジェクトを作成します。
# 作成前の状態
> oc get secret -n openshift-config
NAME TYPE DATA AGE
etcd-client kubernetes.io/tls 2 19h
initial-service-account-private-key Opaque 1 19h
pull-secret kubernetes.io/dockerconfigjson 1 19h
webhook-authentication-integrated-oauth Opaque 1 19h
# 作成の実施
> oc create secret generic htpass-secret --from-file=htpasswd=users.htpasswd -n openshift-config
secret/htpass-secret created
# 作成後の状態
> oc get secret -n openshift-config
NAME TYPE DATA AGE
etcd-client kubernetes.io/tls 2 33m
htpass-secret Opaque 1 6s
initial-service-account-private-key Opaque 1 43m
pull-secret kubernetes.io/dockerconfigjson 1 43m
webhook-authentication-integrated-oauth Opaque 1 21m
htpasswdのカスタムリソース(CR)を作成します。
これはhtpasswd IdPのパラメーターと許可される値を定義したものとなり、 oauth_cr.yamlというファイル名で作成します。
> cat oauth_cr.yaml
apiVersion: config.openshift.io/v1
kind: OAuth
metadata:
name: cluster
spec:
identityProviders:
- name: my_htpasswd_provider
mappingMethod: claim
type: HTPasswd
htpasswd:
fileData:
name: htpass-secret
> oc apply -f oauth_cr.yaml
Warning: resource oauths/cluster is missing the kubectl.kubernetes.io/last-applied-configuration annotation which is required by oc apply. oc apply should only be used on resources created declaratively by either oc create --save-config or oc apply. The missing annotation will be patched automatically.
oauth.config.openshift.io/cluster configured
htpasswdの作業時に作成したユーザocpadminをクラスター管理者として定義します。
> oc create clusterrolebinding admin --clusterrole=cluster-admin --user=ocadmin
clusterrolebinding.rbac.authorization.k8s.io/admin created
OpenShiftのGUIでocpadminによるログインを確認します。
ログイン時にはmy_htpassword_providerの方を選択して実施します。
参考及びリンク
単一ノードに OpenShift をインストールするための要件
Trident + OpenShift: A NetApp + Red Hat solution to dynamically provision storage for OpenShift
























