Linux x86_64 에서 Elasticsearch 데이터 저장소 생성하기

Elasticsearch 연산자를 설치하고 데이터 저장소를 설정하십시오.

Elasticsearch 연산자 버전 및 이미지 태그

고정된 Helm 차트 또는 운영자 버전에는 다음 이미지가 필요합니다.

표 1. 배포용 운영체제 버전 및 이미지 태그
플랫폼 오퍼레이터 버전 Helm 차트 버전 태그가 있는 이미지
Linux® x86_64 3.4.1 3.4.1 artifact-public.instana.io/self-hosted-images/3rd-party/operator/elasticsearch: 3.4.1_v0.34.0

artifact-public.instana.io/self-hosted-images/3rd-party/datastore/elasticsearch: 8.18.6_v0.25.0

Elasticsearch 온라인 설치

Elasticsearch 데이터 저장소를 설치하려면 다음 단계를 완료하십시오.

  1. instana-elastic 네임스페이스를 작성하십시오.

    kubectl create namespace instana-elastic
     
  2. 서비스 elasticsearch 계정을 생성합니다.

    kubectl create serviceaccount elasticsearch -n instana-elastic
     
  3. instana-elastic 네임스페이스에 대한 이미지 풀 시크릿을 작성하십시오. 사용자 고유의 다운로드 키를 사용하여 <download_key> 값을 업데이트하십시오.

    kubectl create secret docker-registry instana-registry --namespace instana-elastic \
    --docker-username=_ \
    --docker-password=<download_key> \
    --docker-server=artifact-public.instana.io
     
  4. Elasticsearch 운영자를 설치하십시오.

    helm install elastic-operator instana/eck-operator -n instana-elastic --version=3.4.1 --set image.repository=artifact-public.instana.io/self-hosted-images/3rd-party/operator/elasticsearch --set image.tag=3.4.1_v0.34.0 --set imagePullSecrets[0].name="instana-registry"
     
  5. 예를 elastic.yaml들어, Elasticsearch 구성을 포함하는 ` YAML ` 파일을 생성합니다.

    apiVersion: elasticsearch.k8s.elastic.co/v1
    kind: Elasticsearch
    metadata:
      name: instana
    spec:
      version: 8.18.6
      image: artifact-public.instana.io/self-hosted-images/3rd-party/datastore/elasticsearch:8.18.6_v0.25.0
      nodeSets:
        - name: default
          count: 3
          config:
            node.roles: 
              - master
              - data
              - ingest
            node.store.allow_mmap: false
            search.max_buckets: 300000
          podTemplate:
            spec:
              # Add the following podAntiAffinity snippet to schedule each pod on a different node. 
              # affinity:
              #   podAntiAffinity:
              #     requiredDuringSchedulingIgnoredDuringExecution:
              #     - labelSelector:
              #           matchLabels:
              #             elasticsearch.k8s.elastic.co/cluster-name: instana
              #       topologyKey: kubernetes.io/hostname          
              serviceAccountName: elasticsearch
              imagePullSecrets:
                - name: instana-registry
              # Add the following securityContext snippet for Kubernetes offerings other than OCP.
              # securityContext:
              #   fsGroup: 1000
              #   runAsGroup: 1000
              #   runAsUser: 1000
          volumeClaimTemplates:
            - metadata:
                name: elasticsearch-data # Do not change this name unless you set up a volume mount for the data path.
              spec:
                accessModes:
                  - ReadWriteOnce
                resources:
                  requests:
                    storage: 20Gi
      http:
        tls:
          selfSignedCertificate:
            disabled: true
     
  6. Elasticsearch 배치 및 확인 (온라인 및 오프라인)의 단계를 완료하십시오.

Elasticsearch 오프라인 설치

설치 준비시 외부 레지스트리에서 Elasticsearch 이미지를 아직 가져오지 않은 경우 지금 가져올 수 있습니다. bastion 호스트에서 다음 명령을 실행하십시오. 그런 다음, 해당 이미지를 에어갭 환경에 있는 Instana 호스트로 복사하십시오.

docker pull artifact-public.instana.io/self-hosted-images/3rd-party/operator/elasticsearch:3.4.1_v0.34.0
docker pull artifact-public.instana.io/self-hosted-images/3rd-party/datastore/elasticsearch:8.18.6_v0.25.0
         

Instana 호스트에서 다음 단계를 수행하십시오.

  1. 이미지를 내부 이미지 레지스트리에 다시 태그 지정하십시오.

    docker tag artifact-public.instana.io/self-hosted-images/3rd-party/operator/elasticsearch:3.4.1_v0.34.0 <internal-image-registry>/operator/elasticsearch:3.4.1_v0.34.0
    docker tag artifact-public.instana.io/self-hosted-images/3rd-party/datastore/elasticsearch:8.18.6_v0.25.0 <internal-image-registry>/datastore/elasticsearch:8.18.6_v0.25.0
                   
  2. 이미지를 내부 이미지 레지스트리에 푸시하십시오.

    docker push <internal-image-registry>/operator/elasticsearch:3.4.1_v0.34.0
    docker push <internal-image-registry>/datastore/elasticsearch:8.18.6_v0.25.0
                   
  3. Elasticsearch 인스턴스에 대한 instana-elastic 네임스페이스를 작성하십시오.

    kubectl create namespace instana-elastic
     
  4. 서비스 elasticsearch 계정을 생성합니다.

    kubectl create serviceaccount elasticsearch -n instana-elastic
     
  5. 선택 사항입니다: 내부 이미지 레지스트리에 인증이 필요한 경우 이미지 풀 시크릿을 생성합니다.

    kubectl create secret docker-registry <secret_name> --namespace instana-elastic \
    --docker-username=<registry_username> \
    --docker-password=<registry_password> \
    --docker-server=<internal-image-registry>:<internal-image-registry-port> \
    --docker-email=<registry_email>
     
  6. Elasticsearch 운영자를 설치하십시오. 이전 단계에서 이미지 풀 시크릿을 만든 경우 다음 명령에 --set imagePullSecrets[0].name="<internal-image-registry-pull-secret>"을 추가합니다.

    helm install elastic-operator eck-operator-3.4.1.tgz -n instana-elastic --version=3.4.1 --set image.repository=<internal-image-registry>/operator/elasticsearch --set image.tag=3.4.1_v0.34.0
                   
  7. 예를 elasticsearch.yaml들어, Elasticsearch 구성을 포함하는 ` YAML ` 파일을 생성합니다.

    apiVersion: elasticsearch.k8s.elastic.co/v1
    kind: Elasticsearch
    metadata:
      name: instana
    spec:
      version: 8.18.6
      image: <internal-image-registry>/datastore/elasticsearch:8.18.6_v0.25.0
      nodeSets:
        - name: default
          count: 3
          config:
            node.roles: 
              - master
              - data
              - ingest
            node.store.allow_mmap: false
          podTemplate:
            spec:
              # Add the following podAntiAffinity snippet to schedule each pod on a different node. .
              # affinity:
              #   podAntiAffinity:
              #     requiredDuringSchedulingIgnoredDuringExecution:
              #     - labelSelector:
              #           matchLabels:
              #             elasticsearch.k8s.elastic.co/cluster-name: instana
              #       topologyKey: kubernetes.io/hostname
              serviceAccountName: elasticsearch
            # Optional: if you created an image pull secret for your internal registry, uncomment the following lines and update the image pull secret information.
            # imagePullSecrets:
            #   - name: <internal-image-registry-pull-secret>
              # Add the following securityContext snippet for Kubernetes offerings other than OCP.
              # securityContext:
              #   fsGroup: 1000
              #   runAsGroup: 1000
              #   runAsUser: 1000
          volumeClaimTemplates:
            - metadata:
                name: elasticsearch-data # Do not change this name unless you set up a volume mount for the data path.
              spec:
                accessModes:
                  - ReadWriteOnce
                resources:
                  requests:
                    storage: 20Gi
      http:
        tls:
          selfSignedCertificate:
            disabled: true
     
  8. Elasticsearch 배치 및 확인 (온라인 및 오프라인)의 단계를 완료하십시오.

Elasticsearch 배포 및 검증 (온라인 및 오프라인)

Elasticsearch 인스턴스를 배치하고 데이터 저장소를 작성하려면 다음 단계를 완료하십시오.

  1. Elasticsearch를 배치하십시오. 기본적으로 이름이 elastic 인 사용자는 무작위로 생성된 비밀번호를 사용하여 작성됩니다.

    kubectl apply -f elastic.yaml -n instana-elastic
    kubectl wait elasticsearch/instana --for=condition=ReconciliationComplete --timeout=300s -n instana-elastic
     
  2. 비밀번호를 검색하십시오.

    kubectl get secret instana-es-elastic-user -n instana-elastic -o go-template='{{.data.elastic | base64decode}}' && echo
     
  3. 다음 코드 조각에 표시된 대로 검색된 비밀번호를 config.yaml 에 저장하십시오. < RETRIEVED_FROM_SECRET > 을 이전 단계에서 얻은 비밀번호로 바꾸십시오.

    datastoreConfigs:
      ...
      elasticsearchConfig:
        adminUser: elastic
        adminPassword: <RETRIEVED_FROM_SECRET>
        user: elastic
        password: <RETRIEVED_FROM_SECRET>
      ...
     
  4. Elasticsearch 운영자 배치를 확인하십시오.

    kubectl get all -n instana-elastic
     

    Elasticsearch 운영자가 성공적으로 배치된 경우 명령 출력은 다음 예제에 표시된 대로 운영자 상태를 Running 로 표시합니다.

    NAME                       READY   STATUS    RESTARTS      AGE
    pod/elastic-operator-0     1/1     Running   1 (10m ago)   10m
    pod/instana-es-default-0   1/1     Running   0             6m44s
    pod/instana-es-default-1   1/1     Running   0             6m44s
    pod/instana-es-default-2   1/1     Running   0             6m44s
    
    NAME                               TYPE        CLUSTER-IP      EXTERNAL-IP   PORT(S)    AGE
    service/elastic-operator-webhook   ClusterIP   192.168.1.41    <none>        443/TCP    10m
    service/instana-es-default         ClusterIP   None            <none>        9200/TCP   6m46s
    service/instana-es-http            ClusterIP   192.168.1.111   <none>        9200/TCP   6m48s
    service/instana-es-internal-http   ClusterIP   192.168.1.196   <none>        9200/TCP   6m48s
    service/instana-es-transport       ClusterIP   None            <none>        9300/TCP   6m48s
    
    NAME                                  READY   AGE
    statefulset.apps/elastic-operator     1/1     10m
    statefulset.apps/instana-es-default   3/3     6m48s