[root@k8s-192-168-1-140 ~]# kubectl create -f https://download.elastic.co/downloads/eck/3.2.0/crds.yaml customresourcedefinition.apiextensions.k8s.io/agents.agent.k8s.elastic.co created customresourcedefinition.apiextensions.k8s.io/apmservers.apm.k8s.elastic.co created customresourcedefinition.apiextensions.k8s.io/beats.beat.k8s.elastic.co created customresourcedefinition.apiextensions.k8s.io/elasticmapsservers.maps.k8s.elastic.co created customresourcedefinition.apiextensions.k8s.io/elasticsearchautoscalers.autoscaling.k8s.elastic.co created customresourcedefinition.apiextensions.k8s.io/elasticsearches.elasticsearch.k8s.elastic.co created customresourcedefinition.apiextensions.k8s.io/enterprisesearches.enterprisesearch.k8s.elastic.co created customresourcedefinition.apiextensions.k8s.io/kibanas.kibana.k8s.elastic.co created customresourcedefinition.apiextensions.k8s.io/logstashes.logstash.k8s.elastic.co created customresourcedefinition.apiextensions.k8s.io/stackconfigpolicies.stackconfigpolicy.k8s.elastic.co created [root@k8s-192-168-1-140 ~]#
使用kubectl apply 安装operator及其RBAC规则
1 2 3 4 5 6 7 8 9 10 11 12 13
[root@k8s-192-168-1-140 ~]# kubectl apply -f https://download.elastic.co/downloads/eck/3.2.0/operator.yaml namespace/elastic-system created serviceaccount/elastic-operator created secret/elastic-webhook-server-cert created configmap/elastic-operator created clusterrole.rbac.authorization.k8s.io/elastic-operator created clusterrole.rbac.authorization.k8s.io/elastic-operator-view created clusterrole.rbac.authorization.k8s.io/elastic-operator-edit created clusterrolebinding.rbac.authorization.k8s.io/elastic-operator created service/elastic-webhook-server created statefulset.apps/elastic-operator created validatingwebhookconfiguration.admissionregistration.k8s.io/elastic-webhook.k8s.elastic.co created [root@k8s-192-168-1-140 ~]#
查看是否启动完成
1 2 3 4
[root@k8s-192-168-1-140 ~]kubectl get -n elastic-system pods NAME READY STATUS RESTARTS AGE elastic-operator-0 1/1 Running 0 8m38s [root@k8s-192-168-1-140 ~]#
[root@k8s-192-168-1-140 ~]# kubectl apply -f nfs-storage.yaml storageclass.storage.k8s.io/nfs-storage created deployment.apps/nfs-client-provisioner created serviceaccount/nfs-client-provisioner created clusterrole.rbac.authorization.k8s.io/nfs-client-provisioner-runner created clusterrolebinding.rbac.authorization.k8s.io/run-nfs-client-provisioner created role.rbac.authorization.k8s.io/leader-locking-nfs-client-provisioner created rolebinding.rbac.authorization.k8s.io/leader-locking-nfs-client-provisioner created [root@k8s-192-168-1-140 ~]#
查看存储
1 2 3 4 5 6 7 8 9 10 11 12 13 14
[root@k8s-192-168-1-140 ~]# kubectl get storageclasses.storage.k8s.io NAME PROVISIONER RECLAIMPOLICY VOLUMEBINDINGMODE ALLOWVOLUMEEXPANSION AGE nfs-storage (default) k8s-sigs.io/nfs-subdir-external-provisioner Delete Immediate false 6h7m [root@k8s-192-168-1-140 ~]#
[root@k8s-192-168-1-140 ~]# kubectl get pvc NAME STATUS VOLUME CAPACITY ACCESS MODES STORAGECLASS VOLUMEATTRIBUTESCLASS AGE elasticsearch-data-quickstart-es-default-0 Bound pvc-2df832aa-1c54-4af6-8384-5e5c5f167445 5Gi RWO nfs-storage <unset> 39s [root@k8s-192-168-1-140 ~]#
[root@k8s-192-168-1-140 ~]# kubectl get pv NAME CAPACITY ACCESS MODES RECLAIM POLICY STATUS CLAIM STORAGECLASS VOLUMEATTRIBUTESCLASS REASON AGE pvc-2df832aa-1c54-4af6-8384-5e5c5f167445 5Gi RWO Delete Bound default/elasticsearch-data-quickstart-es-default-0 nfs-storage <unset> 43s [root@k8s-192-168-1-140 ~]#
查看ES服务发现
1 2 3 4 5 6 7 8 9
[root@k8s-192-168-1-140 ~]# kubectl get service NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE kubernetes ClusterIP 10.68.0.1 <none> 443/TCP 81d nginx NodePort 10.68.148.53 <none> 80:30330/TCP 81d quickstart-es-default ClusterIP None <none> 9200/TCP 74s quickstart-es-http ClusterIP 10.68.66.232 <none> 9200/TCP 75s quickstart-es-internal-http ClusterIP 10.68.121.73 <none> 9200/TCP 75s quickstart-es-transport ClusterIP None <none> 9300/TCP 75s [root@k8s-192-168-1-140 ~]#
[root@k8s-192-168-1-140 ~]# kubectl get kibana NAME HEALTH NODES VERSION AGE quickstart red 9.2.2 16s [root@k8s-192-168-1-140 ~]# # 查看密码 [root@k8s-192-168-1-140 ~]# kubectl get secret quickstart-es-elastic-user -o=jsonpath='{.data.elastic}' | base64 --decode; echo V3VPqwQMURTSg6zFYvVIsH13 [root@k8s-192-168-1-140 ~]#
[root@k8s-192-168-1-140 ~]# kubectl get service quickstart-kb-http NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE quickstart-kb-http ClusterIP 10.68.103.103 <none> 5601/TCP 2m39s [root@k8s-192-168-1-140 ~]#