又是一个新的开源项目——CRC

官方宣称从openshift v4开始,由CRC这个工具提供provision服务。

每次想安装下最新openshift开源版,先得折腾下名称叫什么:从openshift origin到OKD(至今未知全名是什么),再到现在的CRC(Code Ready Containers)。。。Anyway,至少都还能找到相关官方文档的。

目前CRC官方文档上,提供了很多不同环境的部署包,AWS、Azure、GCP均包含在内。简单看了部署在GCP所需的资源:24CPU、3个静态IP、近800GB的存储。土豪同学请自便,其他童鞋可以一起看laptop部署方案

单机联网部署Openshift v4

  1. 保证你的机器有以下可用资源
  • 4C
  • 8G
  • 35GB
  1. 下载对应操作系统的CRC二进制文件 可以到这里下载CRC可执行文件,以macOS为例,下载地址如下所示:

    https://mirror.openshift.com/pub/openshift-v4/clients/crc/latest/crc-macos-amd64.tar.xz

    流量提醒:1.7G的大小,无限的童鞋请自便。

  2. 运行crc step

    顾名思义,setup本质就是检测你的机器是否可以运行openshift新版,然后下载一堆必要工具。以macOS为例,以下代码里罗列了会下载的工具地址:

    https://github.com/code-ready/crc/blob/master/pkg/crc/preflight/preflight_checks_darwin.go

    可以看到优先使用了hyperkit作为macOS的虚拟Hypervisor,它是Docker公司推出的开源套件,目前docker desktop for mac就是用了它。

    如果大家都整个运行过程感兴趣,可以使用crc setup --log-level debug,效果如下截图:

    setup成功之后,你可以在当前用户home目录下的.crc文件夹,看到一堆下载好的工具,包括必不可少的oc

  3. 运行crc start

    start命令就是启动特定的虚拟化服务,并部署openshift v4平台组件。运行效果如下所示:

    > crc-macos-1.0.0-beta.3-amd64 ./crc start --log-level debug
      INFO Checking if oc binary is cached
      DEBU oc binary already cached
      INFO Checking if HyperKit is installed
      DEBU Checking if hyperkit is installed
      INFO Checking if crc-driver-hyperkit is installed
      DEBU Checking if crc-driver-hyperkit is installed
      DEBU crc-driver-hyperkit is already installed in /Users/davidli/.crc/bin/crc-driver-hyperkit
      INFO Checking file permissions for /etc/resolver/testing
      INFO Checking file permissions for /etc/hosts
      INFO Checking if CRC bundle is cached in '$HOME/.crc'
      # get the pull secret from https://cloud.redhat.com/openshift/install/crc/installer-provisioned 
      ? Image pull secret [? for help] 
      Checking file: /Users/davidli/.crc/machines/crc/.crc-exist
      INFO Loading bundle: crc_hyperkit_4.1.11.crcbundle ... 
      INFO Extracting bundle: crc_hyperkit_4.1.11.crcbundle ... 
      INFO Creating VM ...
      Found binary path at /Users/davidli/.crc/bin/crc-driver-hyperkit
      Launching plugin server for driver hyperkit
      Plugin server listening at address 127.0.0.1:60569
      ......
    

    过程中,需要填入Pull Secret,如果你是红帽订阅用户,可以在官网直接获取。

    如果看到以下信息,说明setup就成功了:

    INFO Starting OpenShift cluster ... [waiting 3m]
    INFO To access the cluster using 'oc', run 'eval $(crc oc-env) && oc login -u kubeadmin -p XXXXXXX https://api.crc.testing:6443'
    INFO Access the OpenShift web-console here: https://console-openshift-console.apps-crc.testing
    INFO Login to the console with user: kubeadmin, password: XXXXXXX
    Making call to close driver server
    (crc) Calling .Close
    Successfully made call to close driver server
    Making call to close connection to plugin binary
    Making call to close driver server
    (crc) DBG | Closing plugin on server side
    (crc) Calling .Close
    Successfully made call to close driver server
    Making call to close connection to plugin binary
    CodeReady Containers instance is running
    

    打开提示的平台地址:https://console-openshift-console.apps-crc.testing,输入提示的credentials,Boom~

    界面风格跟v3基本一致,左侧菜单栏多了很多内容。录制了完整初体验视频,任大家观摩:

https://youtu.be/LPtPXpwjCLM

发表评论

电子邮件地址不会被公开。 必填项已用*标注