added deploy.
This commit is contained in:
parent
df1b09694a
commit
68a8612dec
@ -36,6 +36,15 @@ kubectl create secret docker-registry hubcred --docker-server=https://hub.musk.f
|
|||||||
# kubectl create secret generic protected-appsettings --from-file=.secrets/appsettings.protected.json --namespace=nocr
|
# kubectl create secret generic protected-appsettings --from-file=.secrets/appsettings.protected.json --namespace=nocr
|
||||||
#
|
#
|
||||||
|
|
||||||
|
# Initialize the rabitmq kubernetes cluster and deployment followed by:
|
||||||
|
# https://www.rabbitmq.com/kubernetes/operator/install-operator
|
||||||
|
#
|
||||||
|
# Then apply rabbitmq.yaml
|
||||||
|
|
||||||
|
|
||||||
# Make the main deployment.
|
# Make the main deployment.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
kubectl apply -f deployment.yaml
|
kubectl apply -f deployment.yaml
|
||||||
|
|||||||
67
_deploy/k8s/_rabbit_bak/rabbit_full_cluster_default.yaml
Normal file
67
_deploy/k8s/_rabbit_bak/rabbit_full_cluster_default.yaml
Normal file
@ -0,0 +1,67 @@
|
|||||||
|
apiVersion: rabbitmq.com/v1beta1
|
||||||
|
kind: RabbitmqCluster
|
||||||
|
metadata:
|
||||||
|
annotations:
|
||||||
|
kubectl.kubernetes.io/last-applied-configuration: |
|
||||||
|
{"apiVersion":"rabbitmq.com/v1beta1","kind":"RabbitmqCluster","metadata":{"annotations":{},"name":"rmqc","namespace":"nocr"}}
|
||||||
|
creationTimestamp: "2024-03-28T17:36:44Z"
|
||||||
|
finalizers:
|
||||||
|
- deletion.finalizers.rabbitmqclusters.rabbitmq.com
|
||||||
|
generation: 3
|
||||||
|
name: rmqc
|
||||||
|
namespace: nocr
|
||||||
|
resourceVersion: "1932864"
|
||||||
|
uid: 435cb6a7-423e-4cac-8013-83aff7e165d9
|
||||||
|
spec:
|
||||||
|
delayStartSeconds: 30
|
||||||
|
image: rabbitmq:3.12.2-management
|
||||||
|
override: {}
|
||||||
|
persistence:
|
||||||
|
storage: 10Gi
|
||||||
|
rabbitmq: {}
|
||||||
|
replicas: 1
|
||||||
|
resources:
|
||||||
|
limits:
|
||||||
|
cpu: "2"
|
||||||
|
memory: 2Gi
|
||||||
|
requests:
|
||||||
|
cpu: "1"
|
||||||
|
memory: 2Gi
|
||||||
|
secretBackend:
|
||||||
|
externalSecret: {}
|
||||||
|
service:
|
||||||
|
type: ClusterIP
|
||||||
|
terminationGracePeriodSeconds: 604800
|
||||||
|
tls: {}
|
||||||
|
status:
|
||||||
|
binding:
|
||||||
|
name: rmqc-default-user
|
||||||
|
conditions:
|
||||||
|
- lastTransitionTime: "2024-03-28T17:37:28Z"
|
||||||
|
reason: AllPodsAreReady
|
||||||
|
status: "True"
|
||||||
|
type: AllReplicasReady
|
||||||
|
- lastTransitionTime: "2024-03-28T17:37:28Z"
|
||||||
|
reason: AtLeastOneEndpointAvailable
|
||||||
|
status: "True"
|
||||||
|
type: ClusterAvailable
|
||||||
|
- lastTransitionTime: "2024-03-28T17:36:44Z"
|
||||||
|
reason: NoWarnings
|
||||||
|
status: "True"
|
||||||
|
type: NoWarnings
|
||||||
|
- lastTransitionTime: "2024-03-28T17:37:28Z"
|
||||||
|
message: Finish reconciling
|
||||||
|
reason: Success
|
||||||
|
status: "True"
|
||||||
|
type: ReconcileSuccess
|
||||||
|
defaultUser:
|
||||||
|
secretReference:
|
||||||
|
keys:
|
||||||
|
password: password
|
||||||
|
username: username
|
||||||
|
name: rmqc-default-user
|
||||||
|
namespace: nocr
|
||||||
|
serviceReference:
|
||||||
|
name: rmqc
|
||||||
|
namespace: nocr
|
||||||
|
observedGeneration: 3
|
||||||
96
_deploy/k8s/_rabbit_bak/rabbitmq.yaml
Normal file
96
_deploy/k8s/_rabbit_bak/rabbitmq.yaml
Normal file
@ -0,0 +1,96 @@
|
|||||||
|
apiVersion: apps/v1
|
||||||
|
kind: StatefulSet
|
||||||
|
metadata:
|
||||||
|
name: rabbitmq
|
||||||
|
spec:
|
||||||
|
serviceName: rabbitmq
|
||||||
|
# Three nodes is the recommended minimum. Some features may require a majority of nodes
|
||||||
|
# to be available.
|
||||||
|
replicas: 3
|
||||||
|
volumeClaimTemplates: []
|
||||||
|
selector:
|
||||||
|
matchLabels:
|
||||||
|
app: rabbitmq
|
||||||
|
template:
|
||||||
|
spec:
|
||||||
|
# serviceAccountName: rabbitmq
|
||||||
|
terminationGracePeriodSeconds: 10
|
||||||
|
nodeSelector:
|
||||||
|
# Use Linux nodes in a mixed OS kubernetes cluster.
|
||||||
|
# Learn more at https://kubernetes.io/docs/reference/kubernetes-api/labels-annotations-taints/#kubernetes-io-os
|
||||||
|
kubernetes.io/os: linux
|
||||||
|
containers:
|
||||||
|
- name: rabbitmq-k8s
|
||||||
|
image: rabbitmq:3.8
|
||||||
|
volumeMounts:
|
||||||
|
- name: config-volume
|
||||||
|
mountPath: /etc/rabbitmq
|
||||||
|
# Learn more about what ports various protocols use
|
||||||
|
# at https://www.rabbitmq.com/networking.html#ports
|
||||||
|
ports:
|
||||||
|
- name: http
|
||||||
|
protocol: TCP
|
||||||
|
containerPort: 15672
|
||||||
|
- name: amqp
|
||||||
|
protocol: TCP
|
||||||
|
containerPort: 5672
|
||||||
|
livenessProbe:
|
||||||
|
exec:
|
||||||
|
# This is just an example. There is no "one true health check" but rather
|
||||||
|
# several rabbitmq-diagnostics commands that can be combined to form increasingly comprehensive
|
||||||
|
# and intrusive health checks.
|
||||||
|
# Learn more at https://www.rabbitmq.com/monitoring.html#health-checks.
|
||||||
|
#
|
||||||
|
# Stage 2 check:
|
||||||
|
command: ["rabbitmq-diagnostics", "status"]
|
||||||
|
initialDelaySeconds: 60
|
||||||
|
# See https://www.rabbitmq.com/monitoring.html for monitoring frequency recommendations.
|
||||||
|
periodSeconds: 60
|
||||||
|
timeoutSeconds: 15
|
||||||
|
readinessProbe:
|
||||||
|
exec:
|
||||||
|
# This is just an example. There is no "one true health check" but rather
|
||||||
|
# several rabbitmq-diagnostics commands that can be combined to form increasingly comprehensive
|
||||||
|
# and intrusive health checks.
|
||||||
|
# Learn more at https://www.rabbitmq.com/monitoring.html#health-checks.
|
||||||
|
#
|
||||||
|
# Stage 1 check:
|
||||||
|
command: ["rabbitmq-diagnostics", "ping"]
|
||||||
|
initialDelaySeconds: 20
|
||||||
|
periodSeconds: 60
|
||||||
|
timeoutSeconds: 10
|
||||||
|
imagePullPolicy: Always
|
||||||
|
env:
|
||||||
|
- name: MY_POD_NAME
|
||||||
|
valueFrom:
|
||||||
|
fieldRef:
|
||||||
|
apiVersion: v1
|
||||||
|
fieldPath: metadata.name
|
||||||
|
- name: MY_POD_NAMESPACE
|
||||||
|
valueFrom:
|
||||||
|
fieldRef:
|
||||||
|
fieldPath: metadata.namespace
|
||||||
|
- name: RABBITMQ_USE_LONGNAME
|
||||||
|
value: "true"
|
||||||
|
# See a note on cluster_formation.k8s.address_type in the config file section
|
||||||
|
- name: K8S_SERVICE_NAME
|
||||||
|
value: rabbitmq
|
||||||
|
- name: RABBITMQ_NODENAME
|
||||||
|
value: rabbit@$(MY_POD_NAME).$(K8S_SERVICE_NAME).$(MY_POD_NAMESPACE).svc.cluster.local
|
||||||
|
- name: K8S_HOSTNAME_SUFFIX
|
||||||
|
value: .$(K8S_SERVICE_NAME).$(MY_POD_NAMESPACE).svc.cluster.local
|
||||||
|
- name: RABBITMQ_ERLANG_COOKIE
|
||||||
|
value: "mycookie"
|
||||||
|
- name: RABBITMQ_DEFAULT_USER
|
||||||
|
value: admin
|
||||||
|
- name: RABBITMQ_DEFAULT_PASS
|
||||||
|
value: admin
|
||||||
|
volumes:
|
||||||
|
- name: config-volume
|
||||||
|
configMap:
|
||||||
|
name: rabbitmq-config
|
||||||
|
items:
|
||||||
|
- key: rabbitmq.conf
|
||||||
|
path: rabbitmq.conf
|
||||||
|
- key: enabled_plugins
|
||||||
|
path: enabled_plugins
|
||||||
@ -13,21 +13,44 @@ spec:
|
|||||||
labels:
|
labels:
|
||||||
app: telegram-listener
|
app: telegram-listener
|
||||||
spec:
|
spec:
|
||||||
|
imagePullSecrets:
|
||||||
|
- name: hubcred
|
||||||
containers:
|
containers:
|
||||||
- name: telegram-listener
|
- name: telegram-listener
|
||||||
image: hub.musk.fun/k8s/nocr/telegram_listener:latest
|
image: hub.musk.fun/k8s/nocr/telegram_listener:latest
|
||||||
ports:
|
|
||||||
- containerPort: 80
|
|
||||||
env:
|
env:
|
||||||
- name: "ASPNETCORE_ENVIRONMENT"
|
- name: "ASPNETCORE_ENVIRONMENT"
|
||||||
value: "k8s"
|
value: "k8s"
|
||||||
|
- name: "session_pathname"
|
||||||
|
value: "/app/.secrets/WTelegram.session"
|
||||||
|
- name: ASPNETCORE_rmqc_host
|
||||||
|
valueFrom:
|
||||||
|
secretKeyRef:
|
||||||
|
name: rmqc-default-user
|
||||||
|
key: host
|
||||||
|
- name: ASPNETCORE_rmqc_username
|
||||||
|
valueFrom:
|
||||||
|
secretKeyRef:
|
||||||
|
name: rmqc-default-user
|
||||||
|
key: username
|
||||||
|
- name: ASPNETCORE_rmqc_password
|
||||||
|
valueFrom:
|
||||||
|
secretKeyRef:
|
||||||
|
name: rmqc-default-user
|
||||||
|
key: password
|
||||||
|
- name: ASPNETCORE_rmqc_port
|
||||||
|
valueFrom:
|
||||||
|
secretKeyRef:
|
||||||
|
name: rmqc-default-user
|
||||||
|
key: port
|
||||||
|
- name: ASPNETCORE__RebusRabbitMqOptions__ConnectionString
|
||||||
|
value: "amqp://$(ASPNETCORE_rmqc_username):$(ASPNETCORE_rmqc_password)@$(ASPNETCORE_rmqc_host):$(ASPNETCORE_rmqc_port)/"
|
||||||
volumeMounts:
|
volumeMounts:
|
||||||
- name: secrets
|
- name: secrets
|
||||||
mountPath: /app/.secrets
|
mountPath: /app/.secrets
|
||||||
readOnly: true
|
readOnly: true
|
||||||
imagePullSecrets:
|
|
||||||
- name: hubcred
|
|
||||||
volumes:
|
volumes:
|
||||||
- name: secrets
|
- name: secrets
|
||||||
secret:
|
secret:
|
||||||
secretName: protected-appsettings
|
secretName: secretfiles
|
||||||
|
|
||||||
|
|||||||
5
_deploy/k8s/rabbitmq.yaml
Normal file
5
_deploy/k8s/rabbitmq.yaml
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
apiVersion: rabbitmq.com/v1beta1
|
||||||
|
kind: RabbitmqCluster
|
||||||
|
metadata:
|
||||||
|
name: rmqc
|
||||||
|
namespace: nocr
|
||||||
45
_deploy/k8s/sample.yaml
Normal file
45
_deploy/k8s/sample.yaml
Normal file
@ -0,0 +1,45 @@
|
|||||||
|
apiVersion: apps/v1
|
||||||
|
kind: Deployment
|
||||||
|
metadata:
|
||||||
|
name: example-nginx-deployment
|
||||||
|
namespace: nocr
|
||||||
|
labels:
|
||||||
|
app: nginx
|
||||||
|
spec:
|
||||||
|
replicas: 1
|
||||||
|
selector:
|
||||||
|
matchLabels:
|
||||||
|
app: nginx
|
||||||
|
template:
|
||||||
|
metadata:
|
||||||
|
labels:
|
||||||
|
app: nginx
|
||||||
|
spec:
|
||||||
|
containers:
|
||||||
|
- name: nginx
|
||||||
|
image: nginx:1.14.2
|
||||||
|
ports:
|
||||||
|
- containerPort: 80
|
||||||
|
env:
|
||||||
|
- name: ASPNETCORE_rmqc_host
|
||||||
|
valueFrom:
|
||||||
|
secretKeyRef:
|
||||||
|
name: rmqc-default-user
|
||||||
|
key: host
|
||||||
|
- name: ASPNETCORE_rmqc_username
|
||||||
|
valueFrom:
|
||||||
|
secretKeyRef:
|
||||||
|
name: rmqc-default-user
|
||||||
|
key: username
|
||||||
|
- name: ASPNETCORE_rmqc_password
|
||||||
|
valueFrom:
|
||||||
|
secretKeyRef:
|
||||||
|
name: rmqc-default-user
|
||||||
|
key: password
|
||||||
|
- name: ASPNETCORE_rmqc_port
|
||||||
|
valueFrom:
|
||||||
|
secretKeyRef:
|
||||||
|
name: rmqc-default-user
|
||||||
|
key: port
|
||||||
|
- name: ASPNETCORE__RebusRabbitMqOptions__ConnectionString
|
||||||
|
value: "amqp://$(ASPNETCORE_rmqc_username):$(ASPNETCORE_rmqc_password)@$(ASPNETCORE_rmqc_host):$(ASPNETCORE_rmqc_port)/"
|
||||||
15
_deploy/k8s/service.yaml
Normal file
15
_deploy/k8s/service.yaml
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
apiVersion: v1
|
||||||
|
kind: Service
|
||||||
|
metadata:
|
||||||
|
name: rabbitmq-np
|
||||||
|
namespace: nocr
|
||||||
|
spec:
|
||||||
|
type: NodePort
|
||||||
|
selector:
|
||||||
|
app: hello-world-server-0
|
||||||
|
ports:
|
||||||
|
- name: hello-world-server-0
|
||||||
|
protocol: TCP
|
||||||
|
port: 15672
|
||||||
|
targetPort: 15672
|
||||||
|
nodePort: 30001
|
||||||
17
_deploy/rabbitmq/docker-compose.yml
Normal file
17
_deploy/rabbitmq/docker-compose.yml
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
version: "3"
|
||||||
|
|
||||||
|
services:
|
||||||
|
nocr-rabbitmq:
|
||||||
|
image: rabbitmq:3-management-alpine
|
||||||
|
container_name: nocr-rabbitmq
|
||||||
|
ports:
|
||||||
|
- 5672:5672
|
||||||
|
- 15672:15672
|
||||||
|
environment:
|
||||||
|
RABBITMQ_DEFAULT_USER: admin
|
||||||
|
RABBITMQ_DEFAULT_PASS: admin
|
||||||
|
healthcheck:
|
||||||
|
test: rabbitmq-diagnostics -q ping
|
||||||
|
interval: 5s
|
||||||
|
timeout: 10s
|
||||||
|
retries: 3
|
||||||
@ -1 +1 @@
|
|||||||
Subproject commit 53bda5b83f8ae5c98ea83a6a6f25aa65aba024a2
|
Subproject commit d172a00cb7d1655a3a2216504c4b482d84208377
|
||||||
Loading…
Reference in New Issue
Block a user