Dockerfile准备工作:
下载es-head插件,地址:es-head插件下载
FROM registry.cn-qingdao.aliyuncs.com/fandai/fd-nodejs16COPY elasticsearch-head-master.zip /home/elasticsearch-head-master.zipWORKDIR /home/RUN yum -y install zip unzipRUN unzip elasticsearch-head-master.zip && rm -rf elasticsearch-head-master.zipWORKDIR /home/elasticsearch-head-masterRUN npm install grunt-cliEXPOSE 9100CMD npm run start
docker build -t es-head:latest .
deploy.yamlapiVersion: apps/v1kind: Deploymentmetadata: name: elasticsearch-head namespace: fandaispec: replicas: 1 selector: matchLabels: app: elasticsearch-head template: metadata: labels: app: elasticsearch-head spec: containers: - name: elasticsearch-head image: registry.cn-qingdao.aliyuncs.com/fandai/elasticsearch-head---apiVersion: v1 # 资源版本kind: Service # 资源类型metadata: # 元数据 name: elasticsearch-head # 资源名称 namespace: fandai # 命名空间spec: # 描述 selector: # 标签选择器,用于确定当前service代理哪些pod app: elasticsearch-head type: NodePort # service类型 ports: # 端口信息 - protocol: TCP name: elasticsearch-head port: 9100 # service端口 targetPort: 9100 # pod端口
kubectl apply -f deploy.yaml
配置eshead域名