6
2

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 5 years have passed since last update.

Visual Studio CodeでOpenShiftクラスタを操作する。

Last updated at Posted at 2019-12-13

#はじめに
IBM CloudのマネージドサービスであるRed Hat OpenShift on IBMCloudにVisual Studio Codeで接続してみました。IBM Developer Dojo の OpenShift(Minishift)ワークショップ に参加すると利用できるマネージドサービスのOpenShift(約3日間の時間制限あり)を参加してお借りしたので、お礼にアウトプットします。

別にOpenShiftクラスタAPIに接続できればいいので、Azureでも、MiniShiftでも接続できますよ。

簡単に概要はVisual Studio Codeに OpenShift Connector Extensions を追加して、依存関係のkubectl、oc client、OpenShift Do (odo)をインストールすれば環境が整います。

IBM Cloudでは事前に OpenShift Webコンソールか Copy Login Commandを実行して
ログインに必要なトークンを入手してくださいね。

スクリーンショット 2019-12-13 15.45.13.png

*ログインに必要なトークン

oc login https://c100-e.jp-tok.containers.cloud.ibm.com:32044 --token=xxxxxxx

手順

1.それぞれの環境に合わせてVisual Studio Codeを ダウンロード してインストールします。

2.Visual Studio Codeを起動します。
vscode-02.png
3.左下の歯車マークをクリックして、Extentionsをクリックします。
スクリーンショット 2019-12-13 14.26.30.png
4.「openshift」と入力してExtentionsの絞り込みをし、OpenShift Connector を選択し、Installボタンを押してインストールします。
スクリーンショット 2019-12-13 13.54.31.png
5.インストールが完了したら、Visual Studio Codeを再起動します(Visual Studio Codeを一回閉じて、再度起動)

6.Visual Studio Code起動後、左下のOpenShiftのマークを押して、上の赤丸の→ボタン(Clusterへのログイン)を押します。
スクリーンショット 2019-12-13 15.04.27.png
7.上記のボタンを押すと依存関係がインストールされていない場合は、右下にインストールを促されるので kubectl、OKD client、OpenShift Do (odo)をインストールしてください。
スクリーンショット 2019-12-13 14.35.22.png
スクリーンショット 2019-12-13 14.02.10.png
8.依存関係のインストールが終わると、上の赤丸の→ボタン(Clusterへのログイン)を押します。
スクリーンショット 2019-12-13 14.39.37.png
9.IBM CloudのマネージドサービスではToken を選択します。
スクリーンショット 2019-12-13 14.03.15.png
10.OpenShift Webコンソールの Copy Login Commandで取得したURLを入力します。
スクリーンショット 2019-12-13 14.03.47.png
11.OpenShift Webコンソールの Copy Login Commandで取得したToken[ --token=xxx の xxxの部分]を入力します。
スクリーンショット 2019-12-13 14.04.10.png
11.ログインが完了すると接続したクラスタツリーにプロジェクトの一覧が表示されます。クラスタ名を右クリックすると「New Project 」、「Open Console Dashboard」とOpenShiftクラスタを操作できるのが想像できますよね。
スクリーンショット 2019-12-13 15.17.16.png
12.「Open Console Dashboard」を押すと OpenShiftのWebコンソールが表示されました。
スクリーンショット 2019-12-13 14.07.47.png

まとめ

今回は、ハンズオンの時間内にVisual Studio CodesでOpenShiftを操作する導入部分のみを書きました。Visual Studio Codeを使ってOpenShiftが操作、開発できるのは便利ですね。

この後の使い方は、Red Hat Developer Blogの下記記事が参考になることでしょう
OpenShift Connector: Visual Studio Code extension for Red Hat OpenShift
https://developers.redhat.com/blog/2019/10/31/openshift-connector-visual-studio-code-extension-for-red-hat-openshift/

6
2
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
6
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?