我是kubernetes的初学者,我正在尝试在其中运行一个elasticsearch集群,我正在遵循本(教程)[https://phoenixnap.com/kb/elasticsearch-helm-chart]遵循所有的命令,因为它是,在结束时,当我做
kubectl get pods --namespace=default -l app=elasticsearch-master -w
i am getting
NAME READY STATUS RESTARTS AGE
elasticsearch-master-0 0/1 Init:0/1 0 55s
elasticsearch-master-1 0/1 Init:0/1 0 55s
elasticsearch-master-2 0/1 Init:0/1 0 55s
它们没有进入就绪状态命令
helm test elasticsearch
卡住了,没有响应
这里是日志
kubectl logs -f elasticsearch-master-0
Error from server (BadRequest): container "elasticsearch" in pod "elasticsearch-master-0" is waiting to start: PodInitializing
kubectl logs -f elasticsearch-master-1
Error from server (BadRequest): container "elasticsearch" in pod "elasticsearch-master-1" is waiting to start: PodInitializing
kubectl logs -f elasticsearch-master-2
Error from server (BadRequest): container "elasticsearch" in pod "elasticsearch-master-2" is waiting to start: PodInitializing
和kubectl cluster-info
返回
{
"kind": "Status",
"apiVersion": "v1",
"metadata": {
},
"status": "Failure",
"message": "services "kube-dns:dns" is forbidden: User "system:anonymous" cannot get resource "services/proxy" in API group "" in the namespace "kube-system"",
"reason": "Forbidden",
"details": {
"name": "kube-dns:dns",
"kind": "services"
},
"code": 403
}
这就是我现在所知道的,因为我是一个初学者,请帮助为什么我的elasticsearch节点没有准备好
在GitHub上有一个关于这个头盔的开放问题。
Check once which storage class you have for PVC creation.
然而,这个问题可能有多种原因,如PVC
你可以尝试如果单节点ElasticsearchPVC使用:
动态创建apiVersion: apps/v1
kind: StatefulSet
metadata:
labels:
app : elasticsearch
component: elasticsearch
release: elasticsearch
name: elasticsearch
spec:
podManagementPolicy: Parallel
replicas: 1
revisionHistoryLimit: 10
selector:
matchLabels:
app : elasticsearch
component: elasticsearch
release: elasticsearch
serviceName: elasticsearch
template:
metadata:
creationTimestamp: null
labels:
app : elasticsearch
component: elasticsearch
release: elasticsearch
spec:
containers:
- env:
- name: cluster.name
value: <SET THIS>
- name: discovery.type
value: single-node
- name: ES_JAVA_OPTS
value: -Xms512m -Xmx512m
- name: bootstrap.memory_lock
value: "false"
image: elasticsearch:6.5.0
imagePullPolicy: IfNotPresent
name: elasticsearch
ports:
- containerPort: 9200
name: http
protocol: TCP
- containerPort: 9300
name: transport
protocol: TCP
resources:
limits:
cpu: 250m
memory: 1Gi
requests:
cpu: 150m
memory: 512Mi
securityContext:
privileged: true
runAsUser: 1000
terminationMessagePath: /dev/termination-log
terminationMessagePolicy: File
volumeMounts:
- mountPath: /usr/share/elasticsearch/data
name: elasticsearch-data
dnsPolicy: ClusterFirst
initContainers:
- command:
- sh
- -c
- chown -R 1000:1000 /usr/share/elasticsearch/data
- sysctl -w vm.max_map_count=262144
- chmod 777 /usr/share/elasticsearch/data
- chomod 777 /usr/share/elasticsearch/data/node
- chmod g+rwx /usr/share/elasticsearch/data
- chgrp 1000 /usr/share/elasticsearch/data
image: busybox:1.29.2
imagePullPolicy: IfNotPresent
name: set-dir-owner
resources: {}
securityContext:
privileged: true
terminationMessagePath: /dev/termination-log
terminationMessagePolicy: File
volumeMounts:
- mountPath: /usr/share/elasticsearch/data
name: elasticsearch-data
restartPolicy: Always
schedulerName: default-scheduler
securityContext: {}
terminationGracePeriodSeconds: 10
updateStrategy:
type: OnDelete
volumeClaimTemplates:
- metadata:
creationTimestamp: null
name: elasticsearch-data
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 10Gi