安裝 Instana 後端
如果要安裝 Instana 後端,請完成數個主要步驟來建立 Core 物件、建立相關聯的 Unit 物件,以及根據需要啟用選用特性。 在開始主要步驟之前,請完成數個準備步驟來建立名稱空間及密碼。
提示: Instana kubectl 外掛程式具有一個指令,可針對名稱空間及自訂資源產生 YAML 範本,以協助您開始使用。
kubectl instana template --output-dir <dir>
必要條件
- 必須安裝 Instana kubectl 外掛程式。
- 必要的資料儲存庫必須已啟動且在執行中。 請參閱 方向。
準備步驟
在建立 核心 和 單元之前,您需要先建立名稱空間,並為名稱空間放置一組密鑰,以便您可以從 artifact-public.instana.io 登錄中取回 核心 和 單元 映像檔。
建立名稱空間
核心 和 單元 必須安裝在不同的名稱空間中。 每一個 核心 都需要自己的名稱空間。 可以在相同名稱空間中安裝屬於相同 核心 的多個 單元 。
可以自由選擇名稱空間名稱。 本手冊中使用名稱空間 instana-core 和 instana-units 。
「Instana 運算子」要求名稱空間中必須有標籤 app.kubernetes.io/name 。 值必須是名稱空間的名稱。 運算子會新增這些標籤 (如果遺漏的話)。 直接新增這些標籤是有意義的,特別是在使用 GitOps 進行部署時。
建立名稱為 namespaces.yaml的 YAML 檔案。 請參閱下列範例:
apiVersion: v1
kind: Namespace
metadata:
name: instana-core
labels:
app.kubernetes.io/name: instana-core
---
apiVersion: v1
kind: Namespace
metadata:
name: instana-units
labels:
app.kubernetes.io/name: instana-units
然後,執行下列指令來套用檔案:
kubectl apply -f namespaces.yaml
建立映像檔取回密碼
除非您有自己的 Docker 登錄鏡映 artifact-public.instana.io 且不需要取回密鑰,否則您需要在您使用下列其中一種方式所建立的兩個名稱空間中建立映像檔取回密鑰:
直接建立密鑰。
kubectl create secret docker-registry instana-registry \ --namespace=<namespace> \ --docker-username=_ \ --docker-password=<agent_key> \ --docker-server=artifact-public.instana.io- 將 <namespace_name> 取代為您剛才建立的「核心」名稱空間或「單元」名稱空間的名稱。
- 將 <agent_key> 取代為代理程式金鑰。
建立密鑰的 YAML ,而不套用 YAML。 會列印密鑰而不建立。
kubectl create secret docker-registry instana-registry \ --namespace=<namespace> \ --docker-username=_ \ --docker-password=<agent_key> \ --docker-server=artifact-public.instana.io \ --dry-run=client \ --output=yaml然後,建立密碼。
kubectl create -f <secret-file-name.yaml> --namespace <namespace>- 將 <secret-file-name> 取代為 YAML 檔名。
- 將 <namespace_name> 取代為您剛才建立的「核心」名稱空間或「單元」名稱空間的名稱。
下載授權檔
Instana 需要根據 SalesKey 來啟動的授權。 若要使用 Instana kubectl 外掛程式取得此授權檔,請執行下列指令:
kubectl instana license download --sales-key <SalesKey>
或者,如果您需要手動下載授權,請執行下列指令:
curl https://instana.io/onprem/license/download/v2/allValid?salesId=<your-SalesKey> -o license.json
此授權碼是 Units的 config.yaml 檔案的一部分,稍後會產生此檔案。
建立密鑰
密鑰值未使用 核心 和 單元 資源來配置。 這些必須進入 Kubernetes 密碼。
對於 TLS 憑證,必須在 Core的名稱空間中建立密鑰 instana-tls 。
對於每一個 核心 及每一個 單元 資源,必須在個別名稱空間中建立具有對應名稱的密鑰。
密鑰必須包含 config.yaml 檔案,其結構分別類似於 CoreSpec 或 UnitSpec,並新增認證。
密鑰 instana-tls
密碼 instana-tls 是入口配置的必要項目,且必須在 核心的名稱空間中建立。
| 索引鍵 | 值 |
|---|---|
tls.crt |
可連接 Instana 之網域的 TLS 憑證。 CN (通用名稱) 必須符合 CoreSpec中配置的 baseDomain 。 |
tls.key |
TLS 金鑰。 |
附註: 此密鑰必須是 kubernetes.io/tls類型。
若要建立密鑰 instana-tls,請遵循下列步驟:
產生自簽憑證。
openssl req -x509 -newkey rsa:2048 -keyout tls.key -out tls.crt -days 365 -nodes -subj "/CN=<FQDN-Of-Your-Instana>"將 <FQDN-Of-Your-Instana> 取代為您要安裝 Instana 後端的網域名稱。
建立密鑰來保留新產生的憑證。
kubectl create secret tls instana-tls --namespace instana-core \ --cert=path/to/tls.crt \ --key=path/to/tls.key
核心密碼
使用下列範例中所示的內容來建立 config.yaml 檔案。 檔案的結構與將進一步建立的 CoreSpec 結構完全相同,如下所示。
密鑰值必須進入此「核心密鑰」。 任何其他項目都會進入 CoreSpec。
# Diffie-Hellman parameters to use (optional)
dhParams: |
-----BEGIN DH PARAMETERS-----
<snip/>
-----END DH PARAMETERS-----
# The repository password for accessing the Instana agent repository.
# Use the download key that you received from us
repositoryPassword: mydownloadkey
# The sales key you received from us
salesKey: mysaleskey
# Seed for creating crypto tokens. Pick a random 12 char string
tokenSecret: mytokensecret
# Configuration for raw spans storage
storageConfigs:
rawSpans:
# Required if using S3 or compatible storage bucket.
# Credentials should be configured.
# Not required if IRSA on EKS is used.
s3Config:
accessKeyId: ...
secretAccessKey: ...
# Required if using Google Cloud Storage.
# Credentials should be configured.
# Not required if GKE with workload identity is used.
gcloudConfig:
serviceAccountKey: ...
# SAML/OIDC configuration
serviceProviderConfig:
# Password for the key/cert file
keyPassword: mykeypass
# The combined key/cert file
pem: |
-----BEGIN RSA PRIVATE KEY-----
<snip/>
-----END RSA PRIVATE KEY-----
-----BEGIN CERTIFICATE-----
<snip/>
-----END CERTIFICATE-----
# Required if a proxy is configured that needs authentication
proxyConfig:
# Proxy user
user: myproxyuser
# Proxy password
password: my proxypassword
emailConfig:
# Required if SMTP is used for sending e-mails and authentication is required
smtpConfig:
user: mysmtpuser
password: mysmtppassword
# Required if using for sending e-mail.
# Credentials should be configured.
# Not required if using IRSA on EKS.
sesConfig:
accessKeyId: ...
secretAccessKey: ...
# Optional: You can add one or more custom CA certificates to the component trust stores
# in case internal systems (such as LDAP or alert receivers) which Instana talks to use a custom CA.
customCACert: |
-----BEGIN CERTIFICATE-----
<snip/>
-----END CERTIFICATE-----
# Add more certificates if you need
# -----BEGIN CERTIFICATE-----
# <snip/>
# -----END CERTIFICATE-----
datastoreConfigs:
kafkaConfig:
adminUser: strimzi-kafka-user
adminPassword: <RETRIEVED_FROM_SECRET>
consumerUser: strimzi-kafka-user
consumerPassword: <RETRIEVED_FROM_SECRET>
producerUser: strimzi-kafka-user
producerPassword: <RETRIEVED_FROM_SECRET>
elasticsearchConfig:
adminUser: elastic
adminPassword: <RETRIEVED_FROM_SECRET>
user: elastic
password: <RETRIEVED_FROM_SECRET>
postgresConfigs:
- user: postgres
password: <RETRIEVED_FROM_SECRET>
adminUser: postgres
adminPassword: <RETRIEVED_FROM_SECRET>
cassandraConfigs:
- user: instana-superuser
password: <RETRIEVED_FROM_SECRET>
adminUser: instana-superuser
adminPassword: <RETRIEVED_FROM_SECRET>
clickhouseConfigs:
- user: clickhouse-user
password: <USER_GENERATED_PASSWORD>
adminUser: clickhouse-user
adminPassword: <USER_GENERATED_PASSWORD>
附註:
如果您使用協力廠商 Kubernetes 操作器來設定 Instana 資料儲存庫,則需要將
config.yaml檔案的datastoreConfigs部分複製到這個核心密碼config.yaml檔案,該檔案說明於 使用使用者名稱及密碼檢閱最終配置檔 小節。您可以選擇性地指定自訂 Diffie-Hellman 參數。 您可以執行下列指令來產生它們:
openssl dhparam -out dhparams.pem 2048必須配置用於簽署或驗證與 IDP 交換之訊息的加密金鑰。 將不接受未加密的金鑰。
- 執行下列指令來建立金鑰:
openssl genrsa -aes128 -out key.pem 2048 - 執行下列指令來建立憑證:
openssl req -new -x509 -key key.pem -out cert.pem -days 365 - 執行下列指令,將兩者結合成單一檔案:
cat key.pem cert.pem > sp.pem
- 執行下列指令來建立金鑰:
您必須在 Core 的名稱空間中建立同名的密鑰。 例如,如果「核心」物件的名稱是
instana-core,請執行下列指令來建立密鑰:kubectl create secret generic instana-core --namespace instana-core --from-file=path/to/config.yaml您可以透過配置
config.yaml檔案來連結多個憑證。 請參閱下列範例:customCACert: | -----BEGIN CERTIFICATE----- 74ZaqWwi/JDwLnpi4HnW7h6OlM39I9qeKv1o9qbGUaXdgL+IkcJB4PVgCgeQKGlZ B3ng/iOFe47dTV6Dx3D5v3j7lxuihPJXwcHtRRjSD0GBH0IJeQAL2fK3rk4ldqhI FouqgoyjdONrV0YInRdNWzpl2Nxob33B/U4pwdvKVqDzWDk17+tZEdFvaoqzXFgt hGfnmDtNiGVSLrJjbH+lwN0JHVeUSZHQ0iTfHOna5f39ConGgwIkVDVsDjfYqAW1 -----END CERTIFICATE----- -----BEGIN CERTIFICATE----- 1fm2rJVtuImDPnFMjH75d3SwYPyca+4ZLZwnXgMjE7PJFtUe0niEr40wsPuq4i5L B6LrAoGBAPl/PnwPBdst4AhbNn8FmxLje/DZWtpmZoyITBDq129KCM4xGjS3FyDY 7l69VdaiiFDBXHVDQ6SxQ85z69rk45oGgaU0AVzOb+ZCfTocYb6/xcOVFhLc8h6E HzdlW/vjyvYij+o5hNAyo+2VV7y8DZ92V0fMaVsxQzcU+6vKy6VRAoGBAPK/Jnqg I0MWhP7zgWo4g+9TM67OxeYkXHV1UUEirjH7LQrMhomlJ7yEYUencfY1md/Fssl1 -----END CERTIFICATE----- -----BEGIN CERTIFICATE----- 3LzEkVtMxHiusHVq7a7q8ZMMNEQpdSkPcJU7AoGBAIdw9gjU9IztBJbSbgpwweWu sP8W6C1qyfSEgRB/fEO6ec8EtnRjZFOo9m3xwOI6+Yrsn+fir7EtB41U3x8Oii8K 2Koji7YJqnWvEMfGQ7CxP3jNRn9EvfNPCaG6rkbpX4zuMN48e0xzQwvx/G3FK/d6 waqiKpCXFdwStIHUfS3bAoGAUzo5FBmlsJoBtn9fkiIBWV5a3Nkt6IF+yS+JkqzO AoIA0ICjJ+DabIUoqtpS9VQ0wcAgCo6T5SMrBWOJi7yVaFgMqfe3Sq5tochSI7DC -----END CERTIFICATE-----
單元密鑰
使用下列範例中所示的內容來建立 config-unit.yaml 檔案。 檔案的結構與將進一步建立的 UnitSpec 結構完全相同,如下所示。
密鑰值必須進入此「單元密鑰」。 任何其他內容都會進入 UnitSpec。
# The initial user of this tenant unit with admin role, default admin@instana.local.
# Must be a valid e-mail address.
# NOTE:
# This only applies when setting up the tenant unit.
# Changes to this value won't have any effect.
initialAdminUser: myuser@example.com
# The initial admin password.
# NOTE:
# This is only used for the initial tenant unit setup.
# Changes to this value won't have any effect.
initialAdminPassword: mypass
# A list of Instana licenses. Multiple licenses may be specified.
licenses: [ "license1", "license2" ]
# A list of agent keys. Specifying multiple agent keys enables gradually rotating agent keys.
agentKeys:
- myagentkey
# The download key that you received from us (in the license e-mail, this is called initial agent key).
downloadKey: mydownloadkey
附註:
如果要配置
licenses欄位,請取得 下載授權檔 區段中所下載的授權,如下所示:# cat /path/to/license.json && echo ["abcdefghijklmnopqrstuvwxyz0123456789"]您必須在「單元」名稱空間中建立同名的密鑰。 例如,如果 Unit 物件的名稱是
tenant0-unit0,請執行下列指令來建立密鑰:kubectl create secret generic tenant0-unit0 --namespace instana-units --from-file=config.yaml=/path/to/config-unit.yaml
建立核心
核心 代表共用元件,並負責配置資料儲存庫存取權。 因此,大部分配置都將在這裡發生。
如需相關資訊,請參閱 API 參考資料。
核心 自訂資源必須具有版本 instana.io/v1beta2 及類型 Core。 核心 的配置會進入 spec 區段。
建立 core.yaml 檔案。 核心 的配置會進入 spec 區段。
apiVersion: instana.io/v1beta2
kind: Core
metadata:
namespace: instana-core
name: instana-core
spec:
...
基本配置
執行一些基本配置,如下所示:
apiVersion: instana.io/v1beta2
kind: Core
metadata:
namespace: instana-core
name: instana-core
spec:
# The domain under which Instana is reachable
baseDomain: <instana.example.com>
# Depending on your cluster setup, you may need to specify an image pull secret.
imagePullSecrets:
- name: my-registry-secret
# This configures an SMTP server for sending e-mails.
# Alternatively, Amazon SES is supported. Please see API reference for details.
emailConfig:
smtpConfig:
from: smtp@example.com
host: smtp.example.com
port: 465
useSSL: true
# The Operator can install network policies for restricting network traffic
# to what's required only. By default, network policies are disabled.
# Set this to true if you want to enable them. We suggest you leave this turned off
# initially until you've made sure everything works.
enableNetworkPolicies: true
CPU/ 記憶體資源
操作器使用一組預先定義的資源設定檔,這些設定檔決定指派給個別元件 Pod 的資源。 下列設定檔可用。 依預設,如果未配置任何項目,則會使用 medium 。
smallmediumlargexlargexxlarge
spec:
resourceProfile: large
此外,您可以為每一個元件 Pod 配置自訂 CPU 及記憶體資源。 在下列範例中,使用 填充值 元件。 將 填充值 取代為您要使用的元件,並將 CPU 和記憶體資源指定為您要提供的總計。
spec:
componentConfigs:
- name: filler:
resources:
requests:
cpu: 2.5
memory: 5000Mi
limits:
cpu: 4
memory: 20000Mi
代理程式接收器
接收器是 Instana 代理程式將追蹤資料或度量遞送至 Instana 後端所需的端點。 這通常是先前在 基本配置 區段中配置之 baseDomain 的子網域。
spec:
agentAcceptorConfig:
host: ingress.<instana.example.com>
port: 443
將 <instana.example.com> 取代為先前配置的 baseDomain 。
原始跨距儲存體
您必須使用下列三個選項之一來儲存原始跨距資料:
- S3 (或相容)
- Google Cloud Storage (GCS)
- 檔案系統
S3 (或相容)
若要使用 S3 (或相容) 來儲存原始跨距資料,請配置 核心 ,如下所示:
spec:
storageConfigs:
rawSpans:
s3Config:
# Endpoint address of the object storage.
# Doesn't usually need to be set for S3.
endpoint:
# Region.
region: eu-central-1
# Bucket name.
bucket: mybucket
# Prefix for the storage bucket.
prefix: myspans
# Storage class.
storageClass: Standard
# Bucket name for long-term storage.
bucketLongTerm: mybucket
# Prefix for the long-term storage bucket.
prefixLongTerm: myspans-longterm
# Storage class for objects that are written to the long-term bucket.
storageClassLongTerm: Standard
# If using IRSA
serviceAccountAnnotations:
eks.amazonaws.com/role-arn: arn:aws:iam::111122223333:role/my-role
附註: accessKeyId 和 secretAccessKey 必須進入 4.1.3.2小節中指定的 Core 密鑰。 或者,支援 服務帳戶的 IAM 角色 。
Google Cloud Storage
若要使用 GCS 來儲存原始跨距資料,請配置 核心 ,如下所示:
spec:
storageConfigs:
rawSpans:
gcloudConfig:
# Endpoint address. Doesn't usually need to be set for S3.
endpoint:
# Region.
region: eu-central-1
# Bucket name.
bucket: mybucket
# Prefix for the storage bucket.
prefix: myspans
# Storage class.
storageClass: Standard
# Bucket name for long-term storage.
bucketLongTerm: mybucket
# Prefix for the long-term storage bucket.
prefixLongTerm: myspans-longterm
# Storage class for objects that are written to the long-term bucket.
storageClassLongTerm: Standard
# If using Workload Identity
serviceAccountAnnotations:
iam.gke.io/gcp-service-account: rawspans@myproject.iam.gserviceaccount.com
附註: serviceAccountKey 必須進入 4.1.3.2小節中指定的「核心密碼」。 或者,支援 工作量身分 。
檔案系統
若要使用「檔案系統」來儲存原始跨距資料,請配置 核心 ,如下所示:
spec:
storageConfigs:
rawSpans:
pvcConfig:
accessModes:
- ReadWriteMany
resources:
requests:
storage: 100Gi
volumeName: my-nfs-volume
storageClassName: ""
附註: 您必須配置 pvcConfig,這是 PersistentVolumeclaimSpec。 磁區必須具有存取模式 ReadWriteMany。
資料儲存庫
您必須在 核心的 spec 區段中配置下列資料儲存庫:
cassandrapostgresclickhouseelasticsearchkafka
附註:
至少必須為每一個資料儲存庫配置位址。 請參閱下列範例:
spec: ... datastoreConfigs: cassandraConfigs: - hosts: - <IP address or hostname> clickhouseConfigs: - hosts: - <IP address or hostname> postgresConfigs: - hosts: - <IP address or hostname> elasticsearchConfig: hosts: - <IP address or hostname> kafkaConfig: hosts: - <IP address or hostname> ...將 <IP address or hostname> 取代為資料儲存庫的 IP 位址或主機名稱。
如果使用協力廠商「操作員」將資料儲存庫安裝在同一叢集中,則您可以配置
datastoreConfigs,以使用叢集內 DNS 主機名稱來連接至資料儲存庫,如下列配置範例所示:spec: ... datastoreConfigs: cassandraConfigs: - authEnabled: true hosts: - <IP address or hostname> clickhouseConfigs: - authEnabled: true clusterName: local hosts: - <IP address or hostname> - <IP address or hostname> elasticsearchConfig: authEnabled: true clusterName: instana hosts: - <IP address or hostname> kafkaConfig: saslMechanism: SCRAM-SHA-512 authEnabled: true hosts: - <IP address or hostname> postgresConfigs: - authEnabled: true hosts: - <IP address or hostname> ...ClickHouse (預設值:
local) 和 Elasticsearch (預設值:onprem_onprem) 透過clusterName屬性接受叢集名稱。資料儲存庫容許配置
tcp埠。 此外,也可以針對clickhouse和elasticsearch配置http埠。spec: datastoreConfigs: clickhouseConfigs: - clusterName: local hosts: - <IP address or hostname> ports: - name: tcp port: 9000 - name: http port: 8123 schemas: - application - logs如果未配置任何埠,則適用下列預設值:
資料儲存庫 預設埠 cassandratcp=9042postgrestcp=5432clickhousetcp=9000,http=8123elasticsearchtcp=9300,http=9200kafkatcp=9092
改寫資料保留預設值
改寫預設保留設定是選用的,且只應該有意識地執行。 這些保留設定值在 CoreSpec中配置為內容。
基礎架構度量值保留設定
下列保留內容適用於度量累積更新表格,所列出的值是預設值 (以秒為單位)。 值零會告知系統不要捨棄此時間跨距的累積更新。 較小累積更新的零值可能會導致磁碟快速填滿。
kind: Core
metadata:
name: instana-core
namespace: instana-core
spec:
...
properties:
- name: retention.metrics.rollup5
value: "86400"
- name: retention.metrics.rollup60
value: "2678400"
- name: retention.metrics.rollup300
value: "8035200"
- name: retention.metrics.rollup3600
value: "34214400"
...
附註: 圖表精度僅根據所選時間範圍的大小來決定。 這表示變更度量資料保留不會影響 Instana 儀表板中所顯示度量資料的精度。 這些度量保留內容僅供參考,不應變更。
應用程式保留設定
應用程式視景及一般使用者監視 (EUM) 共用短期資料保留內容,預設值為 7 天。 除了短期資料的保留期間之外,長期資料仍會保留 13 個月,且無法配置。
附註: 只有大於或等於 7 天的值才有效。 小於 7 天的值會導致整個系統失敗。
kind: Core
metadata:
name: instana-core
namespace: instana-core
spec:
...
properties:
- name: config.appdata.shortterm.retention.days
value: "7"
...
請參閱下列對應用程式視景資料的影響:
範例:
config.appdata.shortterm.retention.days從 7 天變更為 14 天:
舊資料一旦超過 7 天即會刪除,新資料一旦超過 14 天即會刪除。config.appdata.shortterm.retention.days從 14 天變更為 7 天:
舊資料一旦超過 14 天即會刪除,新資料一旦超過 7 天即會刪除。
請參閱下列對一般使用者監視資料的影響:
範例:
config.appdata.shortterm.retention.days從 7 天變更為 14 天:
舊資料和新資料一旦超過 14 天即會刪除。config.appdata.shortterm.retention.days從 14 天變更為 7 天:
舊資料和新資料一旦超過 7 天即會刪除。
虛構監視保留設定
綜合監視具有個別資料保留內容,預設值為 7 天。 此設定會控制「虛構」測試結果及「虛構」測試結果詳細資料的保留。
kind: Core
metadata:
name: instana-core
namespace: instana-core
spec:
...
properties:
- name: config.synthetics.retention.days
value: "7"
...
請參閱下列對虛構監視資料的影響:
範例:
config.synthetics.retention.days從 7 天變更為 14 天:
配置變更之前儲存的資料一旦超過 7 天就會刪除,配置變更之後儲存的資料一旦超過 14 天就會刪除。config.synthetics.retention.days從 14 天變更為 7 天:
配置變更之前儲存的資料在超過 14 天之前刪除,而配置變更之後儲存的資料在超過 7 天之後刪除。
套用核心配置
在 核心 的配置檔備妥之後,請按如下所示套用:
kubectl apply -f path/to/core.yaml
檢查所有 Pod 是否都在執行中,然後繼續執行,如下所示:
kubectl get pods -n instana-core
建立單元
配置單元是直接明確的。
建立單元 YAML 檔案,例如 unit.yaml ,如下所示:
apiVersion: instana.io/v1beta2
kind: Unit
metadata:
namespace: instana-units
name: tenant0-unit0
spec:
# Must refer to the namespace of the associated Core object that was created previously
coreName: instana-core
# Must refer to the name of the associated Core object that was created previously
coreNamespace: instana-core
# The name of the tenant
# Tenant name must match the regular expression pattern `^[a-z][a-z0-9]*$`
# Tenant name must not exceed a maximum length of 15 characters
# Tenant name must begin with an alphabetical character
# Tenant name can consist of alphanumeric characters
# Characters must be in lowercase
tenantName: tenant0
# The name of the unit within the tenant
unitName: unit0
# The same rules apply as for Cores. May be ommitted. Default is 'medium'
resourceProfile: large
在您的配置備妥之後,請套用您的設定,如下所示:
kubectl apply -f path/to/unit.yaml
檢查所有 Pod 是否都在執行中,然後繼續執行,如下所示:
kubectl get pods -n instana-units
啟用選用特性
依預設,部分特性未在自行管理的後端中啟用。 您可以使用其他配置選項來啟用這類特性。
如需選用特性及其啟用方式的相關資訊,請參閱 啟用選用特性。