LoginSignup
4
3

More than 1 year has passed since last update.

【Openshift Local】セットアップしてみた(旧CodeReady Containers)

Last updated at Posted at 2023-01-28

Openshfit Localとは

共有で使っているOpenShift Container Platformで好き勝手できなくてもやもやしていませんか。
特に初めて触るときはわからず、壊してしまわないか不安になるので、影響のないところでいじくりまわしたいですよね。
そこで登場するのがOpenshift Local!!!
OpenShift Container PlatformをLocal環境で試すことができるプラットフォームです!!!
詳しくは公式を確認してください。
ずっと気になっていたのですが、PCスペックが足らず、、、初ボーナスでPCを買い、ついに動かすことができました!!!

実稼働環境とは異なるようです。

実稼働環境の OpenShift Container Platform インストールとの相違点

  • Red Hat OpenShift Local 用の OpenShift プリセットは、通常の OpenShift Container Platform インストールを提供しますが、以下の顕著な違いがあります。
  • OpenShift Container Platform クラスターは一時的なクラスターであり、実稼働環境での使用を目的としていません。
    Red Hat OpenShift Local には、新しい OpenShift Container Platform バージョンへのサポートされているアップグレードパスがありません。OpenShift Container Platform バージョンをアップグレードすると、再現が困難な問題が発生する可能性があります。
  • コントロールプレーンとワーカーノードの両方として動作する単一のノードを使用します。
  • デフォルトではCluster Monitoring Operatorを無効にします。この無効な Operator により、Web コンソールの対応する部分が機能しなくなります。
  • OpenShift Container Platform クラスターは、インスタンス と呼ばれる仮想マシンで実行します。これにより、特に外部ネットワークとの他の違いが生じる可能性があります。

環境

最小システム要件

物理 CPU コア 4 個
空きメモリー 9 GB
ストレージ領域の 35 GB

自分の環境はWindows11で上記を満たすスペックのマシンです。

セットアップしてみた

  • 公式サイトでユーザ登録&ログイン後のインストール画面からローカルPCへダウンロード

  • ダウンロードしたファイルを展開して、指示に従って再起動

  • コマンドプロンプトを起動し、バージョン確認 crc version

    C:\>crc version
    CRC version: 2.13.1+b5b864fd
    OpenShift version: 4.12.0
    Podman version: 4.3.1
    
  • セットアップ crc setup

    C:\>crc setup
    CRC is constantly improving and we would like to know more about usage (more details at https://developers.redhat.com/article/tool-data-collection)
    Your preference can be changed manually if desired using 'crc config set consent-telemetry <yes/no>'
    Would you like to contribute anonymous usage statistics? [y/N]: N
    No worry, you can still enable telemetry manually with the command 'crc config set consent-telemetry yes'.
    INFO Using bundle path C:\.crc\cache\crc_hyperv_4.12.0_amd64.crcbundle
    INFO Checking if current user is in crc-users and Hyper-V admins group
    INFO Checking if CRC bundle is extracted in '$HOME/.crc'
    INFO Checking if C:\.crc\cache\crc_hyperv_4.12.0_amd64.crcbundle exists
    INFO Getting bundle for the CRC executable
    INFO Downloading bundle: C:\.crc\cache\crc_hyperv_4.12.0_amd64.crcbundle...
    2.96 GiB / 2.96 GiB [-----------------------------------------------------------------------------------------------] 100.00% 1.40 MiB p/s
    INFO Uncompressing C:\.crc\cache\crc_hyperv_4.12.0_amd64.crcbundle
    crc.vhdx: 12.74 GiB / 12.74 GiB [------------------------------------------------------------------------------------------------] 100.00%
    oc.exe: 99.99 MiB / 99.99 MiB [--------------------------------------------------------------------------------------------------] 100.00%
    INFO Checking if the daemon task is installed
    INFO Installing the daemon task
    INFO Checking if the daemon task is running
    INFO Running the daemon task
    INFO Checking admin helper service is running
    Your system is correctly setup for using CRC. Use 'crc start' to start the instance
    
  • 仮想マシン起動 crc start 途中でSecretを入力

    C:\>crc start
    INFO Checking if running in a shell with administrator rights
    INFO Checking Windows release
    INFO Checking Windows edition
    INFO Checking if Hyper-V is installed and operational
    INFO Checking if Hyper-V service is enabled
    INFO Checking if crc-users group exists
    INFO Checking if current user is in crc-users and Hyper-V admins group
    INFO Checking if vsock is correctly configured
    INFO Checking if the daemon task is installed
    INFO Checking if the daemon task is running
    INFO Checking admin helper service is running
    INFO Loading bundle: crc_hyperv_4.12.0_amd64...
    CRC requires a pull secret to download content from Red Hat.
    You can copy it from the Pull Secret section of https://console.redhat.com/openshift/create/local.
    ? Please enter the pull secret
     ********ここでSecretを入力する********
    INFO Creating CRC VM for openshift 4.12.0...
    INFO Generating new SSH key pair...
    INFO Generating new password for the kubeadmin user
    INFO Starting CRC VM for openshift 4.12.0...
    INFO CRC instance is running with IP 127.0.0.1
    INFO CRC VM is running
    INFO Updating authorized keys...
    INFO Check internal and public DNS query...
    INFO Check DNS query from host...
    INFO Verifying validity of the kubelet certificates...
    INFO Starting kubelet service
    INFO Waiting for kube-apiserver availability... [takes around 2min]
    INFO Adding user's pull secret to the cluster...
    INFO Updating SSH key to machine config resource...
    INFO Waiting for user's pull secret part of instance disk...
    INFO Changing the password for the kubeadmin user
    INFO Updating cluster ID...
    INFO Updating root CA cert to admin-kubeconfig-client-ca configmap...
    INFO Starting openshift instance... [waiting for the cluster to stabilize]
    INFO 8 operators are progressing: dns, image-registry, ingress, kube-storage-version-migrator, network, ...
    INFO 5 operators are progressing: image-registry, ingress, network, openshift-controller-manager, service-ca
    INFO 5 operators are progressing: image-registry, ingress, network, openshift-controller-manager, service-ca
    INFO 4 operators are progressing: image-registry, network, openshift-controller-manager, service-ca
    INFO 4 operators are progressing: image-registry, network, openshift-controller-manager, service-ca
    INFO 4 operators are progressing: image-registry, network, openshift-controller-manager, service-ca
    INFO 4 operators are progressing: image-registry, network, openshift-controller-manager, service-ca
    INFO 4 operators are progressing: image-registry, network, openshift-controller-manager, service-ca
    INFO 4 operators are progressing: image-registry, network, openshift-controller-manager, service-ca
    INFO 3 operators are progressing: image-registry, openshift-controller-manager, service-ca
    INFO 2 operators are progressing: image-registry, service-ca
    INFO 2 operators are progressing: image-registry, service-ca
    INFO All operators are available. Ensuring stability...
    INFO Operators are stable (2/3)...
    INFO Operators are stable (3/3)...
    INFO Adding crc-admin and crc-developer contexts to kubeconfig...
    Started the OpenShift cluster.
    
    The server is accessible via web console at:
      https://console-openshift-console.apps-crc.testing
    
    Log in as administrator:
      Username: *************
      Password: *************
    
    Log in as user:
      Username: *************
      Password: *************
    
    Use the 'oc' command line interface:
      > @FOR /f "tokens=*" %i IN ('crc oc-env') DO @call %i
      > oc login -u developer https://api.crc.testing:6443
    
    
  • OCコマンドを有効にするcrc oc-env

    C:\>crc oc-env
    SET PATH=C:\.crc\bin\oc;%PATH%
    REM Run this command to configure your shell:
    REM @FOR /f "tokens=*" %i IN ('crc oc-env') DO @call %i
    
    
    C:\>PATH=C:\.crc\bin\oc;%PATH%
    
  • 起動したアクセスする

    • WEBコンソールの場合crc console
      image.png

    • CLI oc login -u *** -p *** https://api.crc.testing:6443
      image.png

やってみて

思ったよりも簡単にセットアップできるんだと思いました。自宅PCで触れるようになってうれしいですね。
これからいじくりまわして勉強していきます。

参照記事はこちら

4
3
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
4
3