有案例参考一下么?想部署一个用来学习
Solo 可以部署在 K8S 上面么?
- Solo
-
Kubernetes
110 引用 • 54 回帖
Kubernetes 是 Google 开源的一个容器编排引擎,它支持自动化部署、大规模可伸缩、应用容器化管理。
-
Q&A
8112 引用 • 37005 回帖 • 160 关注
提问之前请先看《提问的智慧》,好的问题比好的答案更有价值。
相关帖子
-
- 其他回帖
-
-
可以 编写两个 yaml 文件
apiVersion: apps/v1 kind: StatefulSet metadata: name: solo namespace: b3log spec: replicas: 1 selector: matchLabels: app: solo serviceName: solo template: metadata: name: solo labels: app: solo spec: tolerations: - key: "node.kubernetes.io/unreachable" operator: "Exists" effect: "NoExecute" tolerationSeconds: 60 - key: "node.kubernetes.io/not-ready" operator: "Exists" effect: "NoExecute" tolerationSeconds: 60 affinity: # 亲和性 nodeAffinity: # Pod亲和性 requiredDuringSchedulingIgnoredDuringExecution: # 硬要求 nodeSelectorTerms: - matchExpressions: - key: node # 根据label是node的键来配对 operator: In # 适用表达式 values: # 值如下 - master # 调度到有master标签的节点 podAntiAffinity: # 如果检测到节点有{app:postgres}则不部署,避免postgres在同一节点重复部署 requiredDuringSchedulingIgnoredDuringExecution: - labelSelector: matchExpressions: - key: app operator: In values: - solo topologyKey: "kubernetes.io/hostname" terminationGracePeriodSeconds: 0 # 异常立即删除 containers: - name: solo securityContext: privileged: true image: b3log/solo:latest imagePullPolicy: IfNotPresent ports: - name: solo containerPort: 8080 env: - name: TZ value: Asia/Shanghai - name: RUNTIME_DB value: "MYSQL" - name: JDBC_USERNAME value: "root" - name: JDBC_PASSWORD value: "root" - name: JDBC_DRIVER value: "com.mysql.cj.jdbc.Driver" - name: JDBC_URL value: "jdbc:mysql://192.168.1.222:3306/solo?useUnicode=yes&characterEncoding=UTF-8&useSSL=false&serverTimezone=UTC&allowPublicKeyRetrieval=true" volumes: - name: tz hostPath: path: /etc/localtime
apiVersion: v1 kind: Service metadata: name: solo namespace: b3log labels: app: solo spec: ports: - port: 8080 targetPort: 8080 name: solo clusterIP: None selector: app: solo --- apiVersion: v1 kind: Service metadata: name: solo-service namespace: b3log labels: app: solo spec: externalIPs: # 暴露Service到外部IP - 192.168.1.228 # IP selector: app: solo ports: - protocol: TCP port: 8080 targetPort: 8080 name: solo
1 回复 - 查看全部回帖
欢迎来到这里!
我们正在构建一个小众社区,大家在这里相互信任,以平等 • 自由 • 奔放的价值观进行分享交流。最终,希望大家能够找到与自己志同道合的伙伴,共同成长。
注册 关于