在 Cloud Foundry

支援的版本

  • cf-deployment v3.0 及更新版本
  • BOSH 引導器 v255.4 及更新版本

支援的儲存格

使用 BOSH 版本來部署 Instana 代理程式

附註: 只有在您使用開放程式碼 Cloud Foundry(相對於 Pivotal Platform (先前稱為 Pivotal Cloud Foundry)) ,或您使用 BOSH 來部署 Cloud Foundry以外的軟體時, 此頁面才相關。 如果您使用 Pivotal Platform 和 Pivotal Ops Manager,強烈建議您使用 Instana Microservices Application Monitoring for Pivotal Platform 磚。

Instana 透過我們的 公用 Artifactory 儲存庫來提供 BOSH 版本。 登入儲存庫需要基本 HTTP 鑑別; 請使用 _ 作為使用者名稱,並使用有效的代理程式金鑰作為密碼。

將 Instana 代理程式 BOSH 版本上傳至 BOSH 引導器

下載代理程式版本時,請執行下列指令,將它上傳至 BOSH 引導器:

bosh upload-release <path/to/agent-bosh-xyz.tar.gz>

套用 Instana 代理程式執行時期配置

若要在整個基礎中部署 Instana 代理程式 BOSH 版本,請使用 BOSH 執行時期配置

若要在部署中部署 Instana 代理程式 BOSH 版本,請遵循下列步驟:

  1. yml 文件中,如下所示,輸入標示為 (REQUIRED)(Optional) 且適合您使用案例的欄位值。

  2. 若要將執行時期配置上傳至 BOSH 引導器,請執行 bosh update-runtime-config 指令。 在更新執行時期配置之後,所有部署都會被視為過時。

  3. 在該部署的下一個 bosh deploy 期間, Director 會將執行時期配置變更套用至每一個部署。

    releases:
      - name: instana-agent
        version:
          # (REQUIRED) Fill in the value with the actual release version.
          # For example, if you downloaded the file
          # agent-bosh-1.157.31.tar.gz, the right value is: 1.157.31
    
    addons:
      - name: instana-agent-infrastructure
        jobs:
          - name: instana-agent
            release: instana-agent
            properties:
              tanzu:
                foundation:
                  id: # (REQUIRED) A technical ID to identify this foundation
                  name: # (REQUIRED) A name to identify this foundation
              instana:
                agent: &agent-configuration
                  mode: INFRASTRUCTURE
                  endpoint: # (REQUIRED) Instana ingress endpoint, e.g., ingress-red-saas.instana.io
                  endpoint_port: # (Optional) Instana ingress endpoint port, default is 443
                  key: # (REQUIRED) Fill this with the agent key for your Instana tenant unit
                  download_key: # (Optional) Download key for downloading agent updates.
                    # This is necessary only in special cases, like running a private update repository.
                    # If not specified, the agent will fall back to the value 'instana.agent.key'.
                  zone: # (Optional, not advised) the name of the zone of the host.
                    # If unspecified, the value of `tanzu.foundation.name` will be used instead.
    
                  # (Optional) Add further configurations for the Agent's configuration.yaml files.
                  # Activate support for the JREs used in the latest Java buildpacks
                  custom_configuration: |
    
                  # (Optional) Add more environment variables to be passed to the Instana agent.
                  # Experimental flags of the Instana agent are activated using environment variables.
                  # It is not advised to use these settings unless instructed by Instana's support.
                  # Each environment variable must be entered in a text line.
                  # This entire stanza can be omitted if there is no proxy between the Instana agents and the Instana backend
                  environment: |
                    USE_ATTACH_TOOLS=true
                  proxy:
                    type: # (Optional) Type of proxy to be used by the agent to connect to the Instana backend.
                    # Valid values are 'http' (works also for HTTPS proxies), 'socks4' and 'socks5'.
                    # Default is to use no proxy.
                    host: # (Optional) Hostname of the proxy server, e.g., 'my.proxy' (without protocol).
                      # This property is required if a value is set for 'instana.agent.proxy.type', and ignored otherwise.
                    port: # (Optional) Port of the proxy server.
                      # This property is required if a value is set for 'instana.agent.proxy.type', and ignored otherwise.
                    user: # (Optional) User to be used to authenticate against the proxy server.
                      # Default is not to use authentication.
                      # This property is ignored if 'instana.agent.proxy.type' has no value set.
                    password: # (Optional) Password to be used to authenticate against the proxy server.
                      # Default is not to use authentication.
                      # This property is ignored if 'instana.agent.proxy.type' or 'instana.agent.proxy.user' have no value set.
                    dns: # (Optional) If set to 'true', DNS will be used to resolve the proxy address.
                      # Default is 'true'.
                      # This property is ignored if 'instana.agent.proxy.type' has no value set.
                    updates:
                      mode:
                        dynamic # Whether the agent should update itself dynamically ("dynamic") or not ("static", default).
                        # Default is dynamic.
                      dynamic:
                        repository:
                          hostname:
                            artifact-public.instana.io # The hostname of the repository to tap for updates to agent and sensors.
                            # The agent will connect to the repository on port 80 and 443.
                          version: # (Optional) Which version of the updates pack to use without further updates (version pinning).
                            # This setting overrides 'instana.agent.updates.dynamic.frequency' and 'instana.agent.updates.dynamic.time'.
                          frequency:# (Optional) How often to update the agent.
                            # Valid values are "DAY" (default, means daily updates), "MONDAY", "TUESDAY", "WEDNESDAY", "THURSDAY", "FRIDAY", "SATURDAY" and "SUNDAY".
                            # Default is 'DAY'.
                          time: # Time of day when the update is executed, expected in hh:mm format in UTC.
                            # Default is '04:30'.
        include:
          stemcell: &supported-linux-stemcells
            - alias: ubuntu-trusty
              os: ubuntu-trusty
            - alias: ubuntu-xenial
              os: ubuntu-xenial
            - alias: ubuntu-bionic
              os: ubuntu-bionic
            - alias: centos-7
              os: centos-7
        exclude:
          jobs:
            - name: garden
              release: garden-runc
      - name: instana-agent-apm
        jobs:
          - name: instana-agent
            release: instana-agent
            properties:
              instana:
                agent:
                  <<: *agent-configuration
                  mode: APM
        include:
          jobs:
            - name: garden
              release: garden-runc
          stemcell: *supported-linux-stemcells
    

如需代理程式更新項目相關原則的相關資訊,請參閱 代理程式版本化及更新管理 文件頁面。

檢查主機代理程式的狀態

安裝主機代理程式之後,您可以在 Instana 使用者介面或主機上檢查主機代理程式的狀態。 如需相關資訊,請參閱 檢查主機代理程式的狀態

配置 Cloud Foundry 感應器

Instana 代理程式能夠從 Cloud Foundry API擷取 Cloud Foundry 應用程式、空間及組織的相關資料。 Instana 使用此資訊來啟動 Cloud Foundry 相關特性,例如:

如果已配置,則每個 Instana 代理程式都能夠從 Cloud Foundry API 收集必要的資料。 不過, 建議只使用一個代理程式來隨時收集資料。 使用動態磚時,我們會透通地由一個 Instana 代理程式自動收集,並採用領導者選擇機制,讓多個 Instana 代理程式處於快速待命狀態,以收集 Cloud Foundry API 資料; 這可確保資料擷取的連續性,例如 BOSH 部署的漸進式更新。 不過,當透過 BOSH 直接部署 Instana 代理程式時,需要明確配置 Cloud Foundry 感應器的設定,我們支援下列作法:

  1. 建議: 讓 Instana 代理程式在 Cloud Controller 虛擬機器上執行 透過 BOSH 執行時期配置收集 Cloud Foundry API 資料
  2. 大量產生 專用 BOSH instance_group 執行特別配置以從 Cloud Foundry API 收集資料的 Instana 代理程式

在 Cloud Controller 機器上共同定位

下列執行時期配置將啟用在雲端控制器的各種實例上執行的 Instana 代理程式,以收集 Cloud Foundry API 資料,並透過 ZooKeeper 版本所提供的領導階層選取機制,隨時協調 Instana 代理程式所執行的動作:

releases:
  - name: instana-agent
    version:# (REQUIRED) Fill in the value with the actual release version.
      # For example, if you downloaded the file
      # agent-bosh-1.157.31.tar.gz, the right value is: 1.157.31
  - name: zookeeper
    version: "0.0.10"
    url: "https://bosh.io/d/github.com/cppforlife/zookeeper-release?v=0.0.10"
    sha1: "a6d227abceebf1e3e68ce4a3cabf68b0b93165d2"

addons:
  - name: instana-cf-sensor
    jobs:
      - name: instana-agent-configuration-cf-sensor
        release: instana-agent
        properties:
          tanzu:
            foundation:
              id: # (REQUIRED) A technical ID to identify this foundation
              name: # (REQUIRED) A name to identify this foundation
          cf:
            uaa:
              client: # (REQUIRED) A UAA client that has the 'cloud_controller.admin_read_only' authorities
              client_secret: # (REQUIRED) Client secret matching the above client
      - name: zookeeper
        release: zookeeper
        properties:
          leader_serves: "yes"
          # 42600 is the legacy leadership election port and we wanna avoid incompatibilities over update
          leader_election_port: 42601
          quorum_port: 42602
    include:
      jobs:
        - name: cloud_controller_ng
          release: capi

如上所述, Instana 代理程式需要具有 cloud_controller.admin_read_only 權限的 Cloud Foundry的 使用者帳戶和授權 (UAA) 用戶端,可以建立:

  • 手動,如 Cloud Foundry 說明文件的 使用 UAA CLI (UAAC) 建立及管理使用者 頁面上所示。
  • 建議: 使用下列額外的 BOSH 執行時期配置,自動使用 instana-agent BOSH 版本的 instana-ensure-uaa-client 工作:
releases:
  - name: instana-agent
    version:# (REQUIRED) Fill in the value with the actual release version.
      # For example, if you downloaded the file
      # agent-bosh-1.157.31.tar.gz, the right value is: 1.157.31

addons:
  - name: instana-ensure-uaa-client
    jobs:
      - name: instana-ensure-uaa-client
        release: instana-agent
        properties:
          cf:
            uaa:
              client: # (REQUIRED) This entry must match the one of the `cf.uaa.client` property of the `instana-cf-sensor` runtime configuration
              client_secret: # (REQUIRED) This entry must match the one of the `cf.uaa.client_secret` property of the `instana-cf-sensor` runtime configuration
    include:
      jobs:
        - name: uaa
          release: uaa

使用 instana-ensure-uaa-client 工作的建議方法具有新增的好處,可確保在錯誤地刪除時自動重建 UAA client 。 請注意, instana-ensure-uaa-client 必須位於執行 uaa 工作的虛擬機器上,才能使用該處可用的認證。

專用實例群組

可以透過建立專用 BOSH 實例群組,來部署已配置為執行 Cloud Foundry 感應器的專用 Instana 代理程式。 不過,我們不建議使用它,因為它會導致大量的計算資源浪費: 感應器所執行的工作是輕量型的,它只是過度使用專用虛擬機器來配置它。 無論如何,下列執行時期配置將產生具有一個專用虛擬機器的實例群組:

---
name: instana-cf-sensor

stemcells:
  - alias: &stemcell_name bosh-aws-xen-hvm-ubuntu-xenial-go_agent
    os: ubuntu-xenial
    version: "621.29"

releases:
  - name: instana-agent
    version: <instana-agent-bosh-release-version>

instance_groups:
  - name: instana-cf-sensor
    azs: ...
    instances: 1
    jobs:
      - name: instana-agent-configuration-cf-sensor
        release: instana-agent
        properties:
          cf:
            api:
              url: <TODO> # e.g., https://api.sys.mypcf.qainfra.instana.io
            uaa:
              url: <TODO> # e.g., https://uaa.sys.mypcf.qainfra.instana.io
              client: <TODO>
              client_secret: <TODO>
    vm_type: t3.micro
    stemcell: *stemcell_name
    networks:
      # Your network setup may look different
      - default:
          - dns
          - gateway
        name: instana-cf-sensor

update:
  canaries: 1
  canary_watch_time: 30000-300000
  max_errors: 2
  max_in_flight: 1
  serial: false
  update_watch_time: 30000-300000

附註:

  1. 此實例群組包含 一個實例。 如果您想要將它調整為多個實例,以便在漸進式更新之間具有復原力,您應該另外在機器上從同名 ZooKeeper 版本開始部署 ZooKeeper 工作。 instana-agent-configuration-cf-sensor 會自動偵測領導層選舉機制的存在 (透過其 BOSH 鏈結) ,並以透明方式採用它。
  2. 您需要手動配置 UAA 及 Cloud Foundry API 的 URI。 這表示您可以在技術上在完全不同的網路中執行此部署,甚至可以在 Cloud Foundry 部署所使用的可用性區域中執行此部署。
  3. 您將需要建立 UAA 用戶端,並符合具有 cloud_controller.admin_read_only 權限的用戶端密碼,如 Cloud Foundry 文件的 使用 UAA CLI (UAAC) 建立及管理使用者 頁面上所示。

移除 Instana 代理程式執行時期配置

如果要移除 Instana 執行時期配置,請執行 bosh update-runtime-config 指令來上傳下列:

releases: []
addons: []

在更新執行時期配置之後,每一個部署的下一個 bosh deploy 期間都會移除 Instana 代理程式 BOSH 版本。 當所有部署都已更新以移除 Instana 代理程式 BOSH 工作時,建議您執行 bosh clean-up 指令,從 BOSH 引導器中移除現在不需要的版本及其構件。