Instalowanie agenta hosta w produkcie Cloud Foundry

Obsługiwane wersje

  • cf-deployment v3.0 i nowsze
  • Przełączniki BOSH w wersji v255.4 lub nowszej

Obsługiwane komórki Stemcells

Wdrażanie agenta Instana za pomocą wersji BOSH

Uwaga: Ta strona jest odpowiednia tylko w przypadku korzystania z platformy Open Source Cloud Foundry, w przeciwieństwie do platformy Pivotal (uprzednio zwanej również Pivotal Cloud Foundry), lub BOSH w celu wdrożenia oprogramowania innego niż Cloud Foundry. Jeśli używane są produkty Pivotal Platform i Pivotal Ops Manager, zdecydowanie zalecamy użycie kafla Instana Microservices Application Monitoring for Pivotal Platform .

Instana udostępnia wersje BOSH za pośrednictwem publicznego repozytorium Artifactory. Logowanie do repozytorium wymaga podstawowego uwierzytelniania HTTP. Jako nazwy użytkownika należy użyć _ , a jako hasła-poprawnego klucza agenta.

Przesyłanie wersji BOSH agenta Instana do przełącznika BOSH

Po pobraniu wersji agenta prześlij ją do przełącznika BOSH, uruchamiając następującą komendę:

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

Stosowanie konfiguracji środowiska wykonawczego agenta Instana

Aby wdrożyć wersję BOSH agenta Instana na całej platformie, należy użyć konfiguracji środowiska wykonawczegoBOSH.

Aby wdrożyć wersję BOSH agenta Instana w różnych wdrożeniach, wykonaj następujące kroki:

  1. W dokumencie yml wprowadź wartości w polach oznaczonych jako (REQUIRED) i (Optional) , które pasują do danego przypadku użycia.

  2. Aby przesłać konfigurację środowiska wykonawczego do przełącznika BOSH, uruchom komendę bosh update-runtime-config . Po zaktualizowaniu konfiguracji środowiska wykonawczego wszystkie wdrożenia są uznawane za nieaktualne.

  3. Program Director stosuje zmiany w konfiguracji środowiska wykonawczego dla każdego wdrożenia podczas następnego bosh deploy dla tego wdrożenia.

    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
    

Więcej informacji na temat strategii otaczających aktualizacje agenta zawiera strona dokumentacji Agent Versioning and Update Management (Zarządzanie wersjami i aktualizacjami agenta).

Sprawdzanie statusu agenta hosta

Po zainstalowaniu agenta hosta można sprawdzić status agenta hosta w interfejsie użytkownika Instana lub na hoście. Więcej informacji na ten temat zawiera sekcja Sprawdzanie statusu agenta hosta.

Konfigurowanie czujnika Cloud Foundry

Agent Instana może pobierać dane dotyczące aplikacji, obszarów i organizacji Cloud Foundry z interfejsu API Cloud Foundry. Instana wykorzystuje te informacje do zasilania funkcji związanych z produktem Cloud Foundry , takich jak:

Po skonfigurowaniu każdy agent Instana może gromadzić niezbędne dane z interfejsu API Cloud Foundry . Jednak zaleca się, aby tylko jeden agent gromadził dane w danym momencie. Korzystając z kafla, w sposób przezroczysty automatyzujemy gromadzenie danych przez jednego agenta Instana, korzystając z mechanizmu wyboru liderów, aby wielu agentów Instana było w trybie pełnej gotowości do gromadzenia danych z interfejsu API Cloud Foundry . Zapewnia to ciągłość pobierania danych, na przykład podczas aktualizacji wdrożeń BOSH. Jednak podczas wdrażania agenta Instana bezpośrednio za pośrednictwem BOSH należy wyraźnie skonfigurować czujnik Cloud Foundry , a obsługiwane są następujące sposoby:

  1. Zalecane: agenty Instana działające na maszynach wirtualnych Cloud Controller gromadzą dane interfejsu API Cloud Foundry za pośrednictwem konfiguracji środowiska wykonawczego BOSH.
  2. Utwórz dedykowane BOSH instance_group z agentami Instana specjalnie skonfigurowanymi do gromadzenia danych z interfejsów API Cloud Foundry .

Współlokowanie komputerów z kontrolerem chmury

Następująca konfiguracja środowiska wykonawczego umożliwi agentom Instana działającym na różnych instancjach produktu Cloud Controller gromadzenie danych API Cloud Foundry , koordynując jednocześnie działanie agenta Instana za pomocą mechanizmu wyboru liderów udostępnianego przez ZooKeeper wydanie:

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

Jak widać powyżej, agent Instana wymaga klienta dla konta użytkownika i autoryzacji (UAA) produktu Cloud Foundryz uprawnieniem cloud_controller.admin_read_only , które można utworzyć:

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

Zaletą zalecanej metody wykorzystującej zadanie instana-ensure-uaa-client jest to, że w przypadku omyłkowo usunięcia agenta UAA client zostanie automatycznie ponownie utworzony. Należy zauważyć, że plik instana-ensure-uaa-client musi znajdować się na maszynach wirtualnych, na których działa zadanie uaa , aby można było użyć dostępnych tam informacji autoryzacyjnych.

Dedykowana grupa instancji

Istnieje możliwość wdrożenia dedykowanych agentów Instana skonfigurowanych do uruchamiania czujnika Cloud Foundry przez utworzenie dedykowanej grupy instancji BOSH. Nie zaleca się go jednak, ponieważ prowadzi to do znacznego marnotrawstwa zasobów obliczeniowych: praca, którą wykonuje czujnik, jest lekka i po prostu przesadza, przydzielając dedykowane maszyny wirtualne. W każdym razie następująca konfiguracja środowiska wykonawczego zwróci grupę instancji z jedną dedykowaną maszyną wirtualną:

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

Uwagi:

  1. Ta grupa instancji zawiera jedną instancję. Aby skaluć ją do więcej niż jednej instancji, aby była elastyczna w przypadku aktualizacji sekwencyjnych, należy dodatkowo wdrożyć na komputerach zadanie ZooKeeper z wersji ZooKeeper o tej samej nazwie. instana-agent-configuration-cf-sensor automatycznie wykryje obecność mechanizmu wyboru liderów (za pośrednictwem powiązań BOSH) i przejmie go w sposób przezroczysty.
  2. Konieczne będzie ręczne skonfigurowanie identyfikatora URI interfejsów API UAA i Cloud Foundry . Oznacza to, że technicznie można uruchomić to wdrożenie w zupełnie innej sieci, a nawet w innej strefie dostępności niż ta, która jest używana we wdrożeniu Cloud Foundry .
  3. Konieczne będzie utworzenie klienta UAA i zgodnego klucza tajnego klienta z uprawnieniem cloud_controller.admin_read_only , jak to pokazano na stronie Tworzenie użytkowników i zarządzanie nimi za pomocą interfejsu CLI UAA (UAAC) w dokumentacji produktu Cloud Foundry .

Usuwanie konfiguracji środowiska wykonawczego agenta Instana

Aby usunąć konfigurację środowiska wykonawczego Instana, prześlij następującą komendę, uruchamiając komendę bosh update-runtime-config :

releases: []
addons: []

Po zaktualizowaniu konfiguracji środowiska wykonawczego wersja BOSH agenta Instana jest usuwana podczas następnego bosh deploy dla każdego wdrożenia. Po zaktualizowaniu wszystkich wdrożeń w celu usunięcia zadań BOSH agenta Instana zaleca się uruchomienie komendy bosh clean-up w celu usunięcia niepotrzebnego wydania i jego artefaktów z programu BOSH Director.