Open yancy-hong opened 1 month ago
使用ECK安装的es。
ECK
k8s部分配置文件:
initContainers: - name: install-plugins securityContext: privileged: true runAsUser: 0 command: - sh - -c - | bin/elasticsearch-plugin install https://get.infini.cloud/elasticsearch/analysis-ik/8.12.2
pod init失败,部分describe pod:
Back-off restarting failed container install-plugins in pod elastic-search-es-default-1_elastic
改配置不自动安装分词器,并重新部署Pod:
initContainers: - name: install-plugins securityContext: privileged: true runAsUser: 0 command: - sh - -c - | echo "hello"
kubectl exec 进入Pod,手动安装分词器:
kubectl exec
bin/elasticsearch-plugin install https://get.infini.cloud/elasticsearch/analysis-ik/8.12.2
报错:
Exception in thread "main" java.nio.file.FileSystemException: /usr/share/elasticsearch/config/analysis-ik: Operation not permitted
即使在k8s的配置里为config/analysis-ik添加权限也还是报这个错:
config/analysis-ik
initContainers: - name: install-plugins securityContext: privileged: true runAsUser: 0 command: - sh - -c - | mkdir -p config/analysis-ik chmod -R 777 config/analysis-ik bin/elasticsearch-plugin install https://get.infini.cloud/elasticsearch/analysis-ik/8.12.2
完整k8s配置:
apiVersion: elasticsearch.k8s.elastic.co/v1 kind: Elasticsearch metadata: name: elastic-search namespace: elastic spec: version: 8.12.2 nodeSets: - name: default count: 2 config: node.store.allow_mmap: false node.roles: ["master", "data", "ingest"] volumeClaimTemplates: - metadata: name: elasticsearch-data spec: accessModes: - ReadWriteOnce resources: requests: storage: 20Gi storageClassName: sc-es podTemplate: spec: containers: - name: elasticsearch resources: requests: memory: 8Gi cpu: 4 limits: memory: 8Gi cpu: 4 initContainers: - name: install-plugins securityContext: privileged: true runAsUser: 0 command: - sh - -c - | bin/elasticsearch-plugin install https://get.infini.cloud/elasticsearch/analysis-ik/8.12.2 transport: service: metadata: name: elastic spec: type: NodePort
sc-es storageClass内容:
sc-es
apiVersion: storage.k8s.io/v1 kind: StorageClass provisioner: nfs.csi.k8s.io metadata: name: sc-es allowVolumeExpansion: true reclaimPolicy: Retain parameters: server: 10.10.10.110 share: /nfs/elastic/search
nfs目录权限:
ls -ld /nfs/elastic/search/ drwxrwxrwx 6 root root 4096 Sep 14 12:03 /nfs/elastic/search/
使用
ECK
安装的es。k8s部分配置文件:
pod init失败,部分describe pod:
改配置不自动安装分词器,并重新部署Pod:
kubectl exec
进入Pod,手动安装分词器:报错:
即使在k8s的配置里为
config/analysis-ik
添加权限也还是报这个错:完整k8s配置:
sc-es
storageClass内容:nfs目录权限: