1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

CodeReady Containersをインストール

Last updated at Posted at 2020-05-03

はじめに

私の環境

  • Lenovo V530
  • プロセッサ AMD Ryzen 3 2200G
  • メモリ 32GB
  • Windows 10 Home Edition
  • VMware Workstation 15 Player

CodeReady Containers

CodeReady Containers 以下、CRC。

CRCの目的

  • 最小限のOpenShift環境をローカルで実行するためのもの
  • 開発とテストの目的である

本番向けとの違い

  • CRCで作成されるOpenShiftは一時的なものであり、本番環境での使用を想定していない
  • Master NodeとWorker Nodeの両方として動作する単一のノードが立ち上がる
  • machine-configmonitoringのOperatorはOFFになっている
  • CRCで作成されたOpenShiftはVM上で実行される(本番もそうかもしれないけど)

インストール

私の環境上にインストールしていく

インストールパターン

以下のインストールパターンが提供されている。今回はLinuxを使う

  • Windows
    • Windows 10 Pro Fall Creaters Update(v1709)が必要
    • Hyper-Vを使う
  • MacOS
    • macOS 10.12 Sierra以降が必要
    • HyperKitを使う
  • Linux
    • RHELかCentOSのv7.5以降か、最新のFedoraが必要
    • libvirtを使う

ハード要件

  • 4つのvCPU
  • 8GBのメモリ
  • 35GBのストレージ容量

VMの設定

  • CPU -> 4vCPU
    • ハードウェア仮想化(AMD-V)を有効化
  • Memory -> 16GB
  • Disc -> 120GB
  • Network -> Bridge
  • OS -> CentOS 7

作業開始

一般ユーザ(ここではopenshift)にsudoを許可

# usermod -aG wheel openshift
# visudo
# # l110付近のコメントアウトを外す
# # %wheel  ALL=(ALL)�������NOPASSWD: ALL

NetworkManagerパッケージをインストールする

$ sudo yum install NetworkManager

CRCをcloud.redhat.comからダウンロードする

$ ls ~/crc-linux-amd64.tar.gz
/home/openshift/crc-linux-amd64.tar.gz

解凍する

$ xz -d /home/openshift/crc-linux-amd64.tar.gz
$ tar xfv /home/openshift/crc-linux-amd64.tar

パスが通っていて、それっぽい所に配置する

$ mv /home/openshift/crc-linux-amd64/crc /usr/local/bin/
$ ls -ltr /usr/local/bin/
合計 2131616
-rwxrwxr-x. 1 openshift openshift 2182771160  3月 30 13:00 crc

セットアップする。

$ crc setup

OpenShiftをスタートする。途中でImage pull secretを聞かれる。
cloud.redhat.comからDLしたSecret(JSON)をそのまま打ち込めばOK。

$ crc start

起動時のログに以下が出力されるので、メモっておく

INFO To access the cluster, first set up your environment by following 'crc oc-env' instructions 
INFO Then you can access it by running 'oc login -u developer -p developer https://api.crc.testing:6443' 
INFO To login as an admin, run 'oc login -u kubeadmin -p xxxxxxxx https://api.crc.testing:6443' 
INFO                                              
INFO You can now run 'crc console' and use these credentials to access the OpenShift web console 
Started the OpenShift cluster

OpenShiftにアクセスする

Web Consoleの場合

GNOMEをインストールして、GUI起動をデフォルトにする。

# yum groupinstall "GNOME Desktop"
# startx
# systemctl set-default graphical.target
# reboot

Web Consoleを起動する。
Firefoxが起動され、ログイン画面が表示される。

crc console

ocコマンドで接続する

パス設定をする。

$ crc oc-env
$ eval $(crc oc-env)

先ほどメモったocコマンドで接続する。

$ oc login -u kubeadmin -p xxxxxxxx https://api.crc.testing:6443

Login successful.

You have access to 53 projects, the list has been suppressed. You can list all projects with 'oc projects'

Using project "default".

その他の操作

停止する時

$ crc stop

消す時

$ crc delete

終わりに

project作ったりとかはOpenShift Documentationに誘導されているので、この後やってみる。

1
0
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
1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?