2
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

IBMCloud PrivateOnlyのROKS/IKSクラスタへのアクセス

Last updated at Posted at 2025-02-19

目的

Public接続がないPrivateOnlyなROKS/IKSクラスタへのアクセス方法について記載する
今回の接続元としては、IBMCloud VPCのVSI(Linux)からの接続とする

IBMCloud CLIのインストール

VSIが準備できたら、IBMCloud CLI/OCプラグインをインストールしておく
スタンドアロン IBM Cloud CLI のインストール
CLI のインストール

IBMCloudへのログイン

VSIからCLIにてログインを実施

ibmcloud login -a cloud.ibm.com -r jp-tok -g sample --apikey Jxxxxxxx

Private Endpointを指定してkubeconfigを設定

プライベート・クラウド・サービス・エンドポイントを介したクラスターへのアクセス

% ibmcloud oc cluster config -c cq29stctxxxxx --admin --endpoint private
OK
cq29stctxxxxx の構成は正常にダウンロードされました。

cq29stctxxxxx のコンテキストを現在の kubeconfig ファイルに追加しました。
これで、クラスターに対して「kubectl」コマンドを実行できます。 例えば、「kubectl get nodes」を実行します。

接続先のProvate Service EndpointのURLを確認

% ibmcloud oc cluster get -c cq29stctxxxxx
クラスター cq29stctxxxxx を取得中...
OK

名前:                                         acs-paas-oc-cluster3-jp-tok
ID:                                           cq29stctxxxxx
状態:                                         normal
状況:                                         All Workers Normal
作成日:                                       2024-07-03 09:42:26 +0900 (7 months ago)
リソース・グループ ID:                        d72766061fce4e839ce2bdd1xxx
リソース・グループ名:                         acs-xx
ポッド・サブネット:                           172.17.128.0/18
サービス・サブネット:                         172.21.0.0/16
ワーカー:                                     2
ワーカー・ゾーン:                             jp-tok-1, jp-tok-2
Ingress サブドメイン:                         acs-paas-oc-cluster3-jp-t-d13c20a3006204865xxce00-0000.jp-tok.containers.appdomain.cloud
Ingress の秘密:                               acs-paas-oc-cluster3-jp-t-d13c20a300620xx6182a0effece00-0000
Ingress 状況:                                 healthy
Ingress メッセージ:                           All Ingress components are healthy.
パブリック・サービス・エンドポイント URL:     https://c115-e.jp-tok.containers.cloud.ibm.com:30916
プライベート・サービス・エンドポイント URL:   https://c115.private.jp-tok.containers.cloud.ibm.com:30916
Key Protect:                                  有効化
プル・シークレット:                           デフォルト名前空間内で有効化
VPC:                                          r022-xx-851b-45e5-918c-5796921c55c4
VPE Gateway:                                  https://cq29stctxxxxx.vpe.private.jp-tok.containers.cloud.ibm.com:30916
OAuth Server URL:                             https://c115-e.jp-tok.containers.cloud.ibm.com:30510
Konnectivity Server URL:                      https://cq29stctxxxxx.vpe.private.jp-tok.containers.cloud.ibm.com:32365
Secure By Default Networking:                 -
Outbound Traffic Protection:                  -

マスター
状況:           Ready (2 weeks ago)
状態:           deployed
正常性:         normal
バージョン:     4.14.43_1595_openshift
ロケーション:   Tokyo
URL:            https://c115-e.jp-tok.containers.cloud.ibm.com:30916

プライベート・サービス・エンドポイント URLの部分をメモっておく

Private Service Endpoint経由でのログイン時に必要なパスワードを取得

https://iam.cloud.ibm.com/identity/passcode
image.png

ログイン

oc login -u passcode -p <上記で取得したパスワード> --server=<上記で確認したプライベートサービスエンドポイントURL>

# oc login -u passcode -p 8BaXKhwy61 --server=https://c115.private.jp-tok.containers.cloud.ibm.com:30916
The server uses a certificate signed by an unknown authority.
You can bypass the certificate check, but any data you send to the server could be intercepted by others.
Use insecure connections? (y/n): y

Login successful.

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

Using project "default".

ログイン後、各種コマンドが正常に確認できる

# oc get node
NAME           STATUS   ROLES           AGE    VERSION
10.244.0.4     Ready    master,worker   161d   v1.26.15+e0953cc
10.244.64.17   Ready    master,worker   161d   v1.26.15+e0953cc
2
1
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
2
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?