Notice
Recent Posts
Recent Comments
Link
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | ||||
4 | 5 | 6 | 7 | 8 | 9 | 10 |
11 | 12 | 13 | 14 | 15 | 16 | 17 |
18 | 19 | 20 | 21 | 22 | 23 | 24 |
25 | 26 | 27 | 28 | 29 | 30 | 31 |
Tags
- kibana
- broker
- Golang
- tls disable
- Elk
- Producer
- k8s
- elastic
- Message
- ElasticSearch
- command
- Helm
- consumer group
- http
- minikube
- Consumer
- 쿠버네티스
- Kafka
- kafka-connect
- create topic
- loadbalance
- partition
- es
- Kubernetes
- Produce
- offset
- Kafka Connect
- eck
- topic
- kafka broker
Archives
- Today
- Total
개발자의 개발괴발
Deploy Elasticsearch on minikube 본문
반응형
Helm으로 설치하기
operator없이 그냥 배포할 수도 있지만 operator가 있으면 k8s에서 운영하기 더 편하다고 한다(안해봐서 모르겠지만 그렇다고 한다.)
그래서 operator를 배포하고 elasticsearch를 배포해보도록 하겠다.
Operator 배포
helm을 이용하면 매우 쉽게 설치할 수 있다.
여기에서 시키는대로만 하면 된다.(helm 버전은 3.2.0부터 가능)
설명에 있는대로 실행해보자.
$ helm repo add elastic https://helm.elastic.co
"elastic" has been added to your repositories
$ helm repo update
Hang tight while we grab the latest from your chart repositories...
...Successfully got an update from the "elastic" chart repository
...Successfully got an update from the "metallb" chart repository
...Successfully got an update from the "istio" chart repository
...Successfully got an update from the "bitnami" chart repository
Update Complete. ⎈Happy Helming!⎈
$ helm list -A
NAME NAMESPACE REVISION UPDATED STATUS CHART APP VERSION
elastic-operator elastic-system 1 2025-04-24 23:03:46.238214 +0900 KST deployed eck-operator-3.0.0 3.0.0
마지막 helm list -A 명령어로 helm에 추가 되었는지 확인할 수 있다.
이제 minikube에 deploy 해보자.
$ helm install elastic-operator elastic/eck-operator -n elastic-system --create-namespace
NAME: elastic-operator
LAST DEPLOYED: Thu Apr 24 23:03:46 2025
NAMESPACE: elastic-system
STATUS: deployed
REVISION: 1
TEST SUITE: None
NOTES:
1. Inspect the operator logs by running the following command:
kubectl logs -n elastic-system sts/elastic-operator
$ k get pod -n elastic-system
NAME READY STATUS RESTARTS AGE
elastic-operator-0 1/1 Running 0 6m30s
기본 설정으로 설치를 하면 elastic-system namespace에 deploy가 된다.
Elasticsearch 배포하기
아래처럼 yaml파일을 만들고 적용시키면 배포가 된다.
여기에서 기본 프레임을 가져왔고 여기에서 volume관련 설정을 추가로 가져왔다.
$ cat <<EOF > elasticsearch.yaml
apiVersion: elasticsearch.k8s.elastic.co/v1
kind: Elasticsearch
metadata:
name: quickstart
namespace: elastic-system
spec:
version: 8.16.1
http:
tls:
selfSignedCertificate:
disabled: true # TLS 비활성화
nodeSets:
- name: default
count: 1
config:
node.store.allow_mmap: false
volumeClaimTemplates:
- metadata:
name: elasticsearch-data
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 5Gi
storageClassName: standard
EOF
$ k apply -f elasticsearch.yaml
확인해보면 잘 배포된 것을 볼 수 있다.
$ k get elasticsearch -n elastic-system
NAME HEALTH NODES VERSION PHASE AGE
quickstart green 1 8.16.1 Ready 3m20s
$ k get pod -n elastic-system
NAME READY STATUS RESTARTS AGE
elastic-operator-0 1/1 Running 0 21h
quickstart-es-default-0 1/1 Running 0 3m26s
포트포워딩하고 요청을 날려보자.
$ k port-forward quickstart-es-default-0 -n elastic-system 9200:9200
Forwarding from 127.0.0.1:9200 -> 9200
Forwarding from [::1]:9200 -> 9200
$ curl http://localhost:9200
{
"error": {
"root_cause": [
{
"type": "security_exception",
"reason": "missing authentication credentials for REST request [/]",
"header": {
"WWW-Authenticate": [
"Basic realm=\"security\", charset=\"UTF-8\"",
"ApiKey"
]
}
}
],
"type": "security_exception",
"reason": "missing authentication credentials for REST request [/]",
"header": {
"WWW-Authenticate": [
"Basic realm=\"security\", charset=\"UTF-8\"",
"ApiKey"
]
}
},
"status": 401
}
에러는 났지만 다행히(?) 서버가 응답을 주었다.
elasticsearch의 user name은 기본으로 elastic이다. 비밀번호는 secret에 저장되어있다.
아래와 같이 확인할 수 있다.
$ k get secret quickstart-es-elastic-user -n elastic-system -o go-template='{{.data.elastic | base64decode}}'
7VDUWK83At537727kUD2pEdJ
아래처럼 다시 요청을 날려보자.
$ PASSWORD=$(kubectl get secret quickstart-es-elastic-user -n elastic-system -o go-template='{{.data.elastic | base64decode}}')
$ curl -u "elastic:$PASSWORD" "http://localhost:9200"
{
"name" : "quickstart-es-default-0",
"cluster_name" : "quickstart",
"cluster_uuid" : "1EGOhkcNSjmhYWOjz_eLtg",
"version" : {
"number" : "8.16.1",
"build_flavor" : "default",
"build_type" : "docker",
"build_hash" : "ffe992aa682c1968b5df375b5095b3a21f122bf3",
"build_date" : "2024-11-19T16:00:31.793213192Z",
"build_snapshot" : false,
"lucene_version" : "9.12.0",
"minimum_wire_compatibility_version" : "7.17.0",
"minimum_index_compatibility_version" : "7.0.0"
},
"tagline" : "You Know, for Search"
}
응답이 잘 온것을 보니 설치가 잘 된것 같다.
반응형
'개발 > ELK' 카테고리의 다른 글
Kibana에 접근하기 (1) | 2025.04.26 |
---|---|
Deploy Elasticsearch and Kibana with Helm (0) | 2025.04.25 |