- 创建namespace,在kubectl中输入以下命令:
kubectl create namespace ekiper
- 创建deployment部署yaml文件,将以下配置复制到一个yaml文件中(比如ekuiper-deployment.yaml)并保存:
apiVersion: apps/v1
kind: Deployment
metadata:
name: ekuiper
namespace: ekiper
spec:
replicas: 1
selector:
matchLabels:
app: ekuiper
template:
metadata:
labels:
app: ekuiper
spec:
containers:
- name: ekuiper
image: lfedge/ekuiper:latest
ports:
- name: http
containerPort: 9081
- name: mqtt
containerPort: 20498
env:
- name: MQTT_SOURCE__DEFAULT__SERVER
value: "tcp://broker.emqx.io:1883"
- name: KUIPER__BASIC__CONSOLELOG
value: "true"
- name: KUIPER__BASIC__IGNORECASE
value: "false"
volumeMounts:
- name: data
mountPath: /kuiper/data
- name: log
mountPath: /kuiper/log
securityContext:
runAsUser: 0
volumes:
- name: data
hostPath:
path: /tmp/data
- name: log
hostPath:
path: /tmp/log
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: ekuiper-manager
namespace: ekiper
spec:
selector:
matchLabels:
app: ekuiper-manager
replicas: 1
template:
metadata:
labels:
app: ekuiper-manager
spec:
containers:
- name: ekuiper-manager
image: emqx/ekuiper-manager:latest
ports:
- name: http
containerPort: 9082
env:
- name: DEFAULT_EKUIPER_ENDPOINT
value: "http://ekuiper:9081"
- 创建service部署yaml文件,将以下配置复制到一个yaml文件中(比如ekuiper-service.yaml)并保存:
apiVersion: v1
kind: Service
metadata:
name: ekuiper
namespace: ekiper
spec:
selector:
app: ekuiper
ports:
- name: http
port: 9081
targetPort: http
- name: mqtt
port: 20498
targetPort: mqtt
type: NodePort
---
apiVersion: v1
kind: Service
metadata:
name: ekuiper-manager
namespace: ekiper
spec:
selector:
app: ekuiper-manager
type: NodePort
ports:
- name: http
port: 9082
targetPort: http
- 应用部署yaml文件,使用kubectl命令应用刚刚创建的两个yaml文件:
kubectl apply -f ekuiper-deployment.yaml
kubectl apply -f ekuiper-service.yaml
- 确认部署结果,查看ekuiper和ekuiper-manager pod的状态是否Running,并且确认service的NodePort是否正确设置:
kubectl get pods -n ekiper
kubectl get services -n ekiper
注:本文由ChatGPT生成
网友评论