一、yaml文件
使用的nfs的动态存储类,需要提前搭建。
# cat lotdb.yaml
apiVersion: v1
kind: PersistentVolumeClaim
metadata:name: logsnamespace: lotdb
spec:storageClassName: "nfs-client"accessModes:- ReadWriteManyresources:requests:storage: 5Gi
---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:name: datanamespace: lotdb
spec:storageClassName: "nfs-client"accessModes:- ReadWriteManyresources:requests:storage: 10Gi
---
apiVersion: apps/v1
kind: Deployment
metadata:name: lotdbnamespace: lotdb
spec:replicas: 1selector:matchLabels:app: lotdbtemplate:metadata:labels:app: lotdbspec:containers:- name: lotdbimage: dhub.kubesre.xyz/apache/iotdb:latestports:- containerPort: 6667volumeMounts:- name: logsmountPath: /iotdb/logs- name: datamountPath: /iotdb/datalivenessProbe:tcpSocket:port: 6667initialDelaySeconds: 40periodSeconds: 10readinessProbe:tcpSocket:port: 6667initialDelaySeconds: 40periodSeconds: 10volumes:- name: logspersistentVolumeClaim:claimName: logs- name: datapersistentVolumeClaim:claimName: datadnsPolicy: "None"dnsConfig:nameservers:- 10.96.0.10searches:- svc.cluster.local- cluster.local
---
apiVersion: v1
kind: Service
metadata:name: lotdbnamespace: lotdb
spec:clusterIP: 10.96.201.174clusterIPs:- 10.96.201.174externalTrafficPolicy: ClusterinternalTrafficPolicy: Clusterports:- nodePort: 30925port: 6667protocol: TCPtargetPort: 6667selector:app: lotdbtype: NodePort## 部署
# kubectl create ns lotdb
# kubectl apply -f lotdb.yaml
二、需要修改的地方
三、查看
# docker pull dhub.kubesre.xyz/apache/iotdb:latest
四、测试;
## 登录
# start-cli.sh -h 127.0.0.1 -p 6667 -u root -pw rootIoTDB> CREATE DATABASE root.lnIoTDB> CREATE TIMESERIES root.ln.wf01.wt01.status WITH DATATYPE=BOOLEAN, ENCODING=PLAINIoTDB> CREATE TIMESERIES root.ln.wf01.wt01.temperature WITH DATATYPE=FLOAT, ENCODING=RLEIoTDB> show TIMESERIESIoTDB> SHOW TIMESERIES root.ln.wf01.wt01.statusIoTDB> INSERT INTO root.ln.wf01.wt01(timestamp,status) values(100,true);IoTDB> INSERT INTO root.ln.wf01.wt01(timestamp,status,temperature) values(200,false,20.71)IoTDB> SELECT status FROM root.ln.wf01.wt01IoTDB> SELECT * FROM root.ln.wf01.wt01IoTDB> SET time_zone=+08:00
Time zone has set to +08:00IoTDB> SHOW time_zone
Current time zone: Asia/Shanghai
五、参考;
IoTDB是否支持k8s部署 (Whether support K8S) · Issue #1614 · apache/iotdb · GitHub
iotdb/docker at master · apache/iotdb · GitHub
# https://github.com/apache/iotdb/tree/master/docker
# https://github.com/apache/iotdb/issues/1614