由于在dockerhub的网站上,odoo并没有说明在kubernetes上如何部署其镜像,并且网络上相关的文章较少,所以在部署时浪费了一些时间,现记录一下。
odoo在dockerhub上的描述:https://registry.hub.docker.com/_/odoo?tab=description
一、系统环境
docker --version
Docker version 19.03.8, build afacb8b
Kubernetes :v1.16.3
platform linux/amd64
Kuboard :v2.0.5.5
postgresql:10.0
odoo:14.0
二、部署postgresql数据库系统
---
apiVersion: apps/v1
kind: Deployment
metadata:
namespace: erp-odoo14
name: db-postgres
annotations:
k8s.kuboard.cn/workload: db-postgres
deployment.kubernetes.io/revision: '1'
k8s.eip.work/displayName: db-postgres
k8s.eip.work/ingress: 'false'
k8s.eip.work/service: ClusterIP
k8s.eip.work/workload: db-postgres
k8s.kuboard.cn/ingress: 'false'
k8s.kuboard.cn/service: ClusterIP
labels:
k8s.eip.work/layer: db
k8s.eip.work/name: db-postgres
spec:
selector:
matchLabels:
k8s.eip.work/layer: db
k8s.eip.work/name: db-postgres
revisionHistoryLimit: 10
template:
metadata:
labels:
k8s.eip.work/layer: db
k8s.eip.work/name: db-postgres
spec:
securityContext:
seLinuxOptions: {}
imagePullSecrets:
- name: dockerhub
restartPolicy: Always
initContainers: []
containers:
- image: 'postgres:10'
imagePullPolicy: Always
name: postgres-odoo
volumeMounts: []
resources:
limits:
requests:
env:
- name: POSTGRES_DB
value: postgres
- name: POSTGRES_PASSWORD
value: odoo
- name: POSTGRES_USER
value: yourpassword
lifecycle: {}
terminationMessagePath: /dev/termination-log
terminationMessagePolicy: File
volumes: []
dnsPolicy: ClusterFirst
dnsConfig: {}
schedulerName: default-scheduler
terminationGracePeriodSeconds: 30
progressDeadlineSeconds: 600
strategy:
type: RollingUpdate
rollingUpdate:
maxUnavailable: 25%
maxSurge: 25%
replicas: 1
---
apiVersion: v1
kind: Service
metadata:
namespace: erp-odoo14
name: db-postgres
annotations:
k8s.kuboard.cn/workload: db-postgres
k8s.eip.work/displayName: db-postgres
k8s.eip.work/workload: db-postgres
labels:
k8s.eip.work/layer: db
k8s.eip.work/name: db-postgres
spec:
selector:
k8s.eip.work/layer: db
k8s.eip.work/name: db-postgres
type: ClusterIP
ports:
- port: 5432
targetPort: 5432
protocol: TCP
name: fp6ksw
nodePort: 0
sessionAffinity: None
三、部署odoo14.0
---
apiVersion: apps/v1
kind: Deployment
metadata:
namespace: erp-odoo14
name: web-odoo
annotations:
k8s.kuboard.cn/workload: web-odoo
deployment.kubernetes.io/revision: '5'
k8s.eip.work/displayName: web-odoo
k8s.eip.work/ingress: 'true'
k8s.eip.work/service: ClusterIP
k8s.eip.work/workload: web-odoo
k8s.kuboard.cn/ingress: 'true'
k8s.kuboard.cn/service: ClusterIP
labels:
k8s.eip.work/layer: web
k8s.eip.work/name: web-odoo
spec:
selector:
matchLabels:
k8s.eip.work/layer: web
k8s.eip.work/name: web-odoo
revisionHistoryLimit: 10
template:
metadata:
labels:
k8s.eip.work/layer: web
k8s.eip.work/name: web-odoo
spec:
securityContext:
seLinuxOptions: {}
imagePullSecrets: []
restartPolicy: Always
initContainers: []
containers:
- image: 'odoo:14.0'
imagePullPolicy: Always
name: web-odoo
volumeMounts: []
resources:
limits:
requests:
env:
- name: HOST
value: db-postgres
- name: USER
value: odoo
- name: PASSWORD
value: yourpassword
lifecycle: {}
terminationMessagePath: /dev/termination-log
terminationMessagePolicy: File
volumes: []
dnsPolicy: ClusterFirst
dnsConfig: {}
schedulerName: default-scheduler
terminationGracePeriodSeconds: 30
progressDeadlineSeconds: 600
strategy:
type: RollingUpdate
rollingUpdate:
maxUnavailable: 25%
maxSurge: 25%
replicas: 1
---
apiVersion: v1
kind: Service
metadata:
namespace: erp-odoo14
name: web-odoo
annotations:
k8s.kuboard.cn/workload: web-odoo
k8s.eip.work/displayName: web-odoo
k8s.eip.work/workload: web-odoo
labels:
k8s.eip.work/layer: web
k8s.eip.work/name: web-odoo
spec:
selector:
k8s.eip.work/layer: web
k8s.eip.work/name: web-odoo
type: ClusterIP
ports:
- port: 8069
targetPort: 8069
protocol: TCP
name: mawfrp
nodePort: 0
sessionAffinity: None
---
apiVersion: networking.k8s.io/v1beta1
kind: Ingress
metadata:
namespace: erp-odoo14
name: web-odoo
annotations:
k8s.kuboard.cn/workload: web-odoo
k8s.eip.work/displayName: web-odoo
k8s.eip.work/workload: web-odoo
labels:
k8s.eip.work/layer: web
k8s.eip.work/name: web-odoo
spec:
rules:
- host: www.odoo14.hrsoft.com
http:
paths:
- path: /
backend:
serviceName: web-odoo
servicePort: mawfrp
四、运行结果
参考文章
1、https://registry.hub.docker.com/_/odoo?tab=description
2、https://github.com/Upsyd/odoo-kubernetes/blob/master/microk8s/odoo.yaml
3、