我想在我的Google云平台上的Kubernetes集群上使用诸如backend之类的elasticsearch来实现具有持久性存储的jaeger安装。
我正在使用jaeger kubernetes模板,并且我从Elasticsearch production setup开始。
我已经下载并修改了configmap.yml
文件以更改密码字段值,并下载了elasticsearch.yml
文件以修复已更改的密码值。
我自定义的.yml
文件保留了这种方式:
configmap.yml
apiVersion: v1
kind: ConfigMap
metadata:
name: jaeger-configuration
labels:
app: jaeger
jaeger-infra: configuration
data:
span-storage-type: elasticsearch
collector: |
es:
server-urls: http://elasticsearch:9200
username: elastic
password: **my-password-value**
collector:
zipkin:
http-port: 9411
query: |
es:
server-urls: http://elasticsearch:9200
username: elastic
password: **my-password-value**
agent: |
collector:
host-port: "jaeger-collector:14267"
elasticsearch.yml
apiVersion: v1
kind: List
items:
- apiVersion: apps/v1beta1
kind: StatefulSet
metadata:
name: elasticsearch
labels:
app: jaeger
jaeger-infra: elasticsearch-statefulset
spec:
serviceName: elasticsearch
replicas: 1
template:
metadata:
labels:
app: jaeger-elasticsearch
jaeger-infra: elasticsearch-replica
spec:
containers:
- name: elasticsearch
image: docker.elastic.co/elasticsearch/elasticsearch:5.6.0
imagePullPolicy: Always
command:
- bin/elasticsearch
args:
- "-Ehttp.host=0.0.0.0"
- "-Etransport.host=127.0.0.1"
volumeMounts:
- name: data
mountPath: /data
readinessProbe:
exec:
command:
- curl
- --fail
- --silent
- --output
- /dev/null
- --user
- elastic:**my-password-value**
- localhost:9200
initialDelaySeconds: 5
periodSeconds: 5
timeoutSeconds: 4
volumes:
- name: data
emptyDir: {}
- apiVersion: v1
kind: Service
metadata:
name: elasticsearch
labels:
app: jaeger
jaeger-infra: elasticsearch-service
spec:
clusterIP: None
selector:
app: jaeger-elasticsearch
ports:
- port: 9200
name: elasticsearch
- port: 9300
name: transport
然后,我使用kubectl
命令从机器到KGE的新密码值创建了kubernetes集群配置
~/w/j/AddPersistVolumToPods ❯❯❯ kubectl create -f configmap.yml
configmap/jaeger-configuration created
~/w/j/AddPersistVolumToPods ❯❯❯
并且我已经通过kubectl
命令通过StatefulSet专用pod(也使用新的密码值)从我的计算机到我的KGE创建了elasticsearch服务
~/w/j/AddPersistVolumToPods ❯❯❯ kubectl create -f elasticsearch.yml
statefulset.apps/elasticsearch created
service/elasticsearch created
~/w/j/AddPersistVolumToPods ❯❯❯
我可以看到我在GKE集群上创建了elasticsearch服务
~/w/j/A/production-elasticsearch ❯❯❯ kubectl get services
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
elasticsearch ClusterIP None <none> 9200/TCP,9300/TCP 41m
kubernetes ClusterIP 10.39.240.1 <none> 443/TCP 1h
~/w/j/A/production-elasticsearch ❯❯❯
我有一个elasticsearch-0
吊舱,其中装有Elasticsearch Service的Docker容器
~/w/j/A/production-elasticsearch ❯❯❯ kubectl get pod elasticsearch-0
NAME READY STATUS RESTARTS AGE
elasticsearch-0 0/1 Running 0 25m
~/w/j/A/production-elasticsearch ❯❯❯
但是当我可以在KGE上详细显示Pod时,我发现Pod发出了一些警告并且不健康...
我获得了广告连播说明的详细信息,并且收到了此警告
Warning Unhealthy 2m6s (x296 over 26m) kubelet, gke-jaeger-persistent-st-default-pool-d72f7fde-ggrk Readiness probe failed:
在这里,我的全部输出中的一部分输出到describe
命令
~/w/j/A/production-elasticsearch ❯❯❯ kubectl describe pod elasticsearch-0
Name: elasticsearch-0
Namespace: default
Node: gke-jaeger-persistent-st-default-pool-d72f7fde-ggrk/10.164.0.2
Start Time: Tue, 08 Jan 2019 13:57:52 +0100
Labels: app=jaeger-elasticsearch
controller-revision-hash=elasticsearch-c684bb745
jaeger-infra=elasticsearch-replica
statefulset.kubernetes.io/pod-name=elasticsearch-0
Annotations: kubernetes.io/limit-ranger: LimitRanger plugin set: cpu request for container elasticsearch
Status: Running
IP: 10.36.2.7
Controlled By: StatefulSet/elasticsearch
Containers:
elasticsearch:
Container ID: docker://54d935f3e07ead105464a003745b80446865eb2417da593857d21c56610f704b
Image: docker.elastic.co/elasticsearch/elasticsearch:5.6.0
Image ID: docker-pullable://docker.elastic.co/elasticsearch/elasticsearch@sha256:f95e7d4256197a9bb866b166d9ad37963dc7c5764d6ae6400e551f4987a659d7
node.kubernetes.io/unreachable:NoExecute for 300s
Events:
Type Reason Age From Message
---- ------ ---- ---- -------
Normal Scheduled 27m default-scheduler Successfully assigned elasticsearch-0 to gke-jaeger-persistent-st-default-pool-d72f7fde-ggrk
Normal SuccessfulMountVolume 27m kubelet, gke-jaeger-persistent-st-default-pool-d72f7fde-ggrk MountVolume.SetUp succeeded for volume "data"
Normal SuccessfulMountVolume 27m kubelet, gke-jaeger-persistent-st-default-pool-d72f7fde-ggrk MountVolume.SetUp succeeded for volume "default-token-vkxnj"
Normal Pulling 27m kubelet, gke-jaeger-persistent-st-default-pool-d72f7fde-ggrk pulling image "docker.elastic.co/elasticsearch/elasticsearch:5.6.0"
Normal Pulled 26m kubelet, gke-jaeger-persistent-st-default-pool-d72f7fde-ggrk Successfully pulledimage "docker.elastic.co/elasticsearch/elasticsearch:5.6.0"
Normal Created 26m kubelet, gke-jaeger-persistent-st-default-pool-d72f7fde-ggrk Created container
Normal Started 26m kubelet, gke-jaeger-persistent-st-default-pool-d72f7fde-ggrk Started container
Warning Unhealthy 2m6s (x296 over 26m) kubelet, gke-jaeger-persistent-st-default-pool-d72f7fde-ggrk Readiness probe failed:
~/w/j/A/production-elasticsearch ❯❯❯
我转到GCP上的容器日志部分,并得到以下信息:
在“审核日志”部分中,我可以看到类似以下内容:
resourceName: "core/v1/namespaces/default/pods/elasticsearch-0"
response: {
@type: "core.k8s.io/v1.Status"
apiVersion: "v1"
code: 500
details: {…}
kind: "Status"
message: "The POST operation against Pod could not be completed at this time, please try again."
metadata: {…}
reason: "ServerTimeout"
status: "Failure"
}
serviceName: "k8s.io"
status: {
code: 13
message: "The POST operation against Pod could not be completed at this time, please try again."
}
}
如果我尝试使用原始文件,并且在GCP上通过KGE更改了密码,则会收到此错误:
Pod "elasticsearch-0" is invalid: spec: Forbidden: pod updates may not change fields other than `spec.containers[*].image`, `spec.initContainers[*].image`, `spec.activeDeadlineSeconds` or `spec.tolerations` (only additions to existing tolerations)
在创建了广告连播之后,是否无法更新或执行某些更改?
kubectl apply -f .....
吗? ...我猜
如何更改Elasticsearch密码?
如果我想在此Pod上配置持久卷声明,我可以在kubectl create -f
命令之前执行此操作,并且在容器和KGE上创建我的卷和mountPath吗?
如果有人可以向我指出正确的地址,我们将不胜感激他们的支持。