k8s deployment files

This commit is contained in:
Roger Sacchelli 2024-04-07 15:26:04 +00:00
parent 1528d885dd
commit 1f99d5a8a0
7 changed files with 263 additions and 0 deletions

View File

@ -0,0 +1,39 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: adapter
spec:
replicas: 1
selector:
matchLabels:
app: adapter
strategy:
type: Recreate # Specify the Recreate strategy
template:
metadata:
labels:
app: adapter
spec:
containers:
- name: adapter
image: oktopusp/adapter:latest
resources:
requests:
memory: 64Mi
cpu: 0.1
limits:
memory: 128Mi
cpu: 0.2
imagePullPolicy: IfNotPresent
env:
- name: NATS_URL
value: "nats://nats:4222"
- name: NATS_NAME
value: "adapter"
- name: NATS_VERIFY_CERTIFICATES
value: "false"
- name: MONGO_URI
value: "mongodb://oktopusp:oktopusp@mongodb-0.mongodb-svc.mongodb.svc.cluster.local:27017,mongodb-1.mongodb-svc.mongodb.svc.cluster.local:27017,mongodb-2.mongodb-svc.mongodb.svc.cluster.local:27017/adapter?replicaSet=mongodb&ssl=false"
- name: CONTROLLER_ID
value: "oktopusController"

View File

@ -0,0 +1,39 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: controller
spec:
replicas: 1
selector:
matchLabels:
app: controller
strategy:
type: Recreate # Specify the Recreate strategy
template:
metadata:
labels:
app: controller
spec:
containers:
- name: controller
image: oktopusp/controller:latest
resources:
#requests:
# memory: 64Mi
# cpu: 0.5
#limits:
# memory: 256Mi
# cpu: 1
imagePullPolicy: IfNotPresent
env:
- name: NATS_URL
value: "nats://nats:4222"
- name: NATS_NAME
value: "adapter"
- name: NATS_VERIFY_CERTIFICATES
value: "false"
- name: MONGO_URI
value: "mongodb://oktopusp:oktopusp@mongodb-0.mongodb-svc.mongodb.svc.cluster.local:27017,mongodb-1.mongodb-svc.mongodb.svc.cluster.local:27017,mongodb-2.mongodb-svc.mongodb.svc.cluster.local:27017/adapter?replicaSet=mongodb&ssl=false"
- name: REST_API_PORT
value: "8000"

View File

@ -0,0 +1,36 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: frontend
spec:
replicas: 1
selector:
matchLabels:
app: frontend
strategy:
type: Recreate # Specify the Recreate strategy
template:
metadata:
labels:
app: frontend
spec:
containers:
- name: frontend
image: oktopusp/frontend:latest
ports:
- containerPort: 3000
imagePullPolicy: IfNotPresent
---
apiVersion: v1
kind: Service
metadata:
name: frontend-svc
spec:
selector:
app: frontend
ports:
- protocol: TCP
port: 3000
targetPort: 3000
nodePort: 30001
type: NodePort

View File

@ -0,0 +1,36 @@
---
apiVersion: mongodbcommunity.mongodb.com/v1
kind: MongoDBCommunity
metadata:
name: mongodb
spec:
members: 3
type: ReplicaSet
version: "6.0.5"
security:
authentication:
modes: ["SCRAM"]
users:
- name: oktopusp
db: admin
passwordSecretRef: # a reference to the secret that will be used to generate the user's password
name: mongo-secret
roles:
- name: clusterAdmin
db: admin
- name: userAdminAnyDatabase
db: admin
scramCredentialsSecretName: my-scram
additionalMongodConfig:
storage.wiredTiger.engineConfig.journalCompressor: zlib
# the user credentials will be generated from this secret
# once the credentials are generated, this secret is no longer required
---
apiVersion: v1
kind: Secret
metadata:
name: mongo-secret
type: Opaque
stringData:
password: oktopusp

View File

@ -0,0 +1,44 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: mqtt-adapter
spec:
replicas: 1
selector:
matchLabels:
app: mqtt-adapter
template:
metadata:
labels:
app: mqtt-adapter
spec:
containers:
- name: mqtt-adapter
image: oktopusp/mqtt-adapter:latest
resources:
requests:
memory: 64Mi
cpu: 0.1
limits:
memory: 128Mi
cpu: 0.2
imagePullPolicy: IfNotPresent
env:
- name: NATS_URL
value: "nats:4222"
- name: NATS_NAME
value: "mqtt-adapter"
- name: NATS_VERIFY_CERTIFICATES
value: "false"
- name: MQTT_URL
value: "tcp://mqtt:1883"
- name: MQTT_CLIENT_ID
value: "mqtt-adapter"
- name: MQTT_USERNAME
value: ""
- name: MQTT_PASSWORD
value: ""
- name: MQTT_QOS
value: "1"
- name: MQTT_SERVICE_HOST
value: "mqtt"

View File

@ -0,0 +1,48 @@
apiVersion: v1
kind: Service
metadata:
name: mqtt
spec:
selector:
app: mqtt
ports:
- protocol: TCP
port: 1883
targetPort: 1883
nodePort: 30000
type: NodePort
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: mqtt
spec:
replicas: 1
selector:
matchLabels:
app: mqtt
template:
metadata:
labels:
app: mqtt
spec:
containers:
- name: mqtt
image: rogersacchelli/mqtt:latest
ports:
- containerPort: 1883
resources:
requests:
memory: 64Mi
cpu: 0.1
limits:
memory: 128Mi
cpu: 0.2
imagePullPolicy: IfNotPresent
env:
- name: MQTT_PORT
value: ":1883"
- name: MQTT_TLS
value: "false"
- name: LOG_LEVEL
value: "0" # 0 - DEBUG

View File

@ -0,0 +1,21 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: socketio
spec:
replicas: 1
selector:
matchLabels:
app: socketio
template:
metadata:
labels:
app: socketio
spec:
containers:
- name: socketio
image: oktopusp/socketio:latest
imagePullPolicy: IfNotPresent
env:
- name: NATS_URL
value: "nats:4222"