はじめに
- みなさん!メリークリスマス!Advent Calendar9日目は、OpenShiftにおけるconfiguration設定(Operator編)の記事となります。
- ホストにInstana Agentをインストール後、Instana Agent用の設定ファイル (configuration.yaml など) を編集することで、Instana UI上の表示変更や、アプリケーション開発フレームワーク、データベースの詳細を可視化などといった、様々な設定を適用できます。
- OpenShiftには、複数のInstana Agentインストール方法がます、今回は、Operatorによる設定および編集方法を紹介します。
- Operator Hub編はこちら
- 次回は、Helm Chart編も公開予定なのでお楽しみに!
公式ドキュメントのリンク
- 実際に設定するときは必ず公式ドキュメントをチェックしてください!
- https://www.ibm.com/docs/ja/instana-observability/latest?topic=agents-installing-red-hat-openshift
設定の前提条件
-
OpenShift 4.18に対して、Operator(手動設定)によるInstana Agentインストールおよび編集をします。 -
Instana UIのインフラストラクチャーマップにおいて、「Instana Maturity Zone」というカスタムゾーンを設定します。
-
下記は、今回変更するconfigurationの抜粋となります。
com.instana.plugin.generic.hardware: enabled: true availability-zone: 'Instana Maturity Zone'
Operatorによる設定例
OperatorでのInstana Agentにおけるconfiguration設定例
-
kubectl applyコマンドを用いて、Instana Agent用Operatorを手動でインストールします。kubectl apply -f https://github.com/instana/instana-agent-operator/releases/latest/download/instana-agent-operator.yaml -
OpenShiftのダッシュボードでもOperatorがインストールされていることを確認できます。
-
Instana Agent用カスタムリソース
instana-agent.customresource.yamlを作成します。設定内容として、configuration_yamlを記載することで、Instana Agentの詳細設定を行うことができます。touch instana-agent.customresource.yaml vi instana-agent.customresource.yamlapiVersion: instana.io/v1 kind: InstanaAgent metadata: name: instana-agent namespace: instana-agent spec: zone: name: # (optional) name of the zone of the host cluster: name: agent: key: <key> downloadKey: <downloadKey> endpointHost: <endpointHost Name> endpointPort: "443" env: {} configuration_yaml: | com.instana.plugin.generic.hardware: enabled: true availability-zone: 'Instana Maturity Zone' -
最後にカスタムリソースをデプロイします。
kubectl apply -f instana-agent.customresource.yaml -
Instana UIにて、
configuration_yamlの設定内容が反映されていることを確認できます。
OperatorでのInstana Agentのconfiguration設定変更例
-
configurationの内容を変更する場合、
instana-agent.customresource.yamlを編集・保存し、再度kubectl applyをすることで反映されます。vi instana-agent.customresource.yaml -
availability-zoneをInstana Maturity Zone Operator Manualに変更します。apiVersion: instana.io/v1 kind: InstanaAgent metadata: name: instana-agent namespace: instana-agent spec: zone: name: # (optional) name of the zone of the host cluster: name: agent: key: <key> downloadKey: <downloadKey> endpointHost: <endpointHost Name> endpointPort: "443" env: {} configuration_yaml: | com.instana.plugin.generic.hardware: enabled: true availability-zone: 'Instana Maturity Zone Operator Manual' -
最後にカスタムリソースをデプロイします。
kubectl apply -f instana-agent.customresource.yaml -
Instana UIにて、configurationの変更内容が反映されていることを確認できます。
うまく反映されない場合、Instana AgentのDaemonSetをRolloutすることをご検討ください。
kubectl rollout restart ds instana-agent -n instana-agent
おわりに
- OperatorによるInstana Agentインストールや設定変更は、実際に反映されている設定パラメータをコードとして残すことができるので便利ですね!
- さらに、
instana-agent.customresource.yamlをバージョン管理システムで管理することで、設定の紛失や意図しない設定変更を防ぐことも期待できそうです。 - 次回は、Helm Chartによる方法を公開予定ですので、ぜひご覧ください!良い年末を!



