Anul 3 Semestrul 2
This commit is contained in:
@@ -0,0 +1,43 @@
|
||||
---
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: apigateway
|
||||
spec:
|
||||
replicas: 1
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
app: apigateway
|
||||
spec:
|
||||
containers:
|
||||
- name: apigateway
|
||||
image: apigateway:latest
|
||||
ports:
|
||||
- containerPort: 80
|
||||
env:
|
||||
- name: ASPNETCORE_URLS
|
||||
value: http://*:80
|
||||
resources:
|
||||
requests:
|
||||
memory: "128Mi"
|
||||
cpu: "100m"
|
||||
limits:
|
||||
memory: "256Mi"
|
||||
cpu: "200m"
|
||||
selector:
|
||||
matchLabels:
|
||||
app: apigateway
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: apigateway
|
||||
spec:
|
||||
type: LoadBalancer
|
||||
ports:
|
||||
- port: 80
|
||||
targetPort: 80
|
||||
nodePort: 32003
|
||||
selector:
|
||||
app: apigateway
|
||||
@@ -0,0 +1,57 @@
|
||||
# kubernetes-deployment-service.yaml
|
||||
|
||||
# ---- Deployment ----
|
||||
# This object defines how to run and manage your application pods.
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: frontend # Name of the Deployment
|
||||
labels:
|
||||
app: react-app # Label to identify resources related to this app
|
||||
spec:
|
||||
replicas: 1 # Number of desired pods (you can adjust this)
|
||||
selector:
|
||||
matchLabels:
|
||||
app: frontend # This must match the labels in the Pod template
|
||||
template: # Defines the Pod that will be created
|
||||
metadata:
|
||||
labels:
|
||||
app: frontend # Labels applied to each Pod
|
||||
spec:
|
||||
containers:
|
||||
- name: frontend # Name of the container within the Pod
|
||||
image: frontend:latest # <<< IMPORTANT: Replace with your actual image name and tag
|
||||
# Ensure this image is accessible by your Kubernetes cluster.
|
||||
imagePullPolicy: Always # Or "IfNotPresent" if you prefer, especially for "latest" tags
|
||||
ports:
|
||||
- containerPort: 80 # The port your Nginx server is listening on inside the container
|
||||
resources:
|
||||
requests:
|
||||
cpu: "100m"
|
||||
memory: "128Mi"
|
||||
limits:
|
||||
cpu: "200m"
|
||||
memory: "256Mi"
|
||||
|
||||
---
|
||||
|
||||
# ---- Service ----
|
||||
# This object defines how to access your application.
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: react-app-service # Name of the Service
|
||||
labels:
|
||||
app: frontend # Label to identify resources related to this app
|
||||
spec:
|
||||
type: LoadBalancer # Exposes the Service externally using a cloud provider's load balancer.
|
||||
# Alternatives:
|
||||
# - NodePort: Exposes the Service on each Node's IP at a static port.
|
||||
# - ClusterIP: Exposes the Service on a cluster-internal IP (default).
|
||||
# - Ingress: For more advanced HTTP/HTTPS routing (requires an Ingress controller).
|
||||
selector:
|
||||
app: frontend # This must match the labels of the Pods you want to target (from the Deployment)
|
||||
ports:
|
||||
- protocol: TCP
|
||||
port: 3000 # The port the Service will be available on (externally or within the cluster)
|
||||
targetPort: 80 # The port on the Pods (containerPort) that the Service will forward traffic to
|
||||
@@ -0,0 +1,57 @@
|
||||
# kubernetes-deployment-service.yaml
|
||||
|
||||
# ---- Deployment ----
|
||||
# This object defines how to run and manage your application pods.
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: frontendadmin # Name of the Deployment
|
||||
labels:
|
||||
app: react-app # Label to identify resources related to this app
|
||||
spec:
|
||||
replicas: 1 # Number of desired pods (you can adjust this)
|
||||
selector:
|
||||
matchLabels:
|
||||
app: frontendadmin # This must match the labels in the Pod template
|
||||
template: # Defines the Pod that will be created
|
||||
metadata:
|
||||
labels:
|
||||
app: frontendadmin # Labels applied to each Pod
|
||||
spec:
|
||||
containers:
|
||||
- name: frontendadmin # Name of the container within the Pod
|
||||
image: frontendadmin:latest # <<< IMPORTANT: Replace with your actual image name and tag
|
||||
# Ensure this image is accessible by your Kubernetes cluster.
|
||||
imagePullPolicy: Always # Or "IfNotPresent" if you prefer, especially for "latest" tags
|
||||
ports:
|
||||
- containerPort: 80 # The port your Nginx server is listening on inside the container
|
||||
resources:
|
||||
requests:
|
||||
cpu: "100m"
|
||||
memory: "128Mi"
|
||||
limits:
|
||||
cpu: "200m"
|
||||
memory: "256Mi"
|
||||
|
||||
---
|
||||
|
||||
# ---- Service ----
|
||||
# This object defines how to access your application.
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: frontendadmin-service # Name of the Service
|
||||
labels:
|
||||
app: frontendadmin # Label to identify resources related to this app
|
||||
spec:
|
||||
type: LoadBalancer # Exposes the Service externally using a cloud provider's load balancer.
|
||||
# Alternatives:
|
||||
# - NodePort: Exposes the Service on each Node's IP at a static port.
|
||||
# - ClusterIP: Exposes the Service on a cluster-internal IP (default).
|
||||
# - Ingress: For more advanced HTTP/HTTPS routing (requires an Ingress controller).
|
||||
selector:
|
||||
app: frontendadmin # This must match the labels of the Pods you want to target (from the Deployment)
|
||||
ports:
|
||||
- protocol: TCP
|
||||
port: 3001 # The port the Service will be available on (externally or within the cluster)
|
||||
targetPort: 80 # The port on the Pods (containerPort) that the Service will forward traffic to
|
||||
@@ -0,0 +1,70 @@
|
||||
---
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: inventoryservice
|
||||
spec:
|
||||
replicas: 1
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
app: inventoryservice
|
||||
annotations:
|
||||
prometheus.io/scrape: "true"
|
||||
prometheus.io/path: "/metrics"
|
||||
prometheus.io/port: "80"
|
||||
spec:
|
||||
containers:
|
||||
- name: inventoryservice
|
||||
image: inventoryservice:latest
|
||||
ports:
|
||||
- containerPort: 80
|
||||
env:
|
||||
- name: ASPNETCORE_URLS
|
||||
value: http://*:80
|
||||
resources:
|
||||
requests:
|
||||
memory: "128Mi"
|
||||
cpu: "150m"
|
||||
limits:
|
||||
memory: "256Mi"
|
||||
cpu: "200m"
|
||||
selector:
|
||||
matchLabels:
|
||||
app: inventoryservice
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: inventoryservice
|
||||
labels:
|
||||
app: inventoryservice
|
||||
spec:
|
||||
type: LoadBalancer
|
||||
ports:
|
||||
- port: 8081
|
||||
targetPort: 80
|
||||
nodePort: 32002
|
||||
name: inventoryport
|
||||
selector:
|
||||
app: inventoryservice
|
||||
|
||||
---
|
||||
apiVersion: autoscaling/v2
|
||||
kind: HorizontalPodAutoscaler
|
||||
metadata:
|
||||
name: inventoryservice-hpa
|
||||
spec:
|
||||
scaleTargetRef:
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
name: inventoryservice
|
||||
minReplicas: 1
|
||||
maxReplicas: 3
|
||||
metrics:
|
||||
- type: Resource
|
||||
resource:
|
||||
name: cpu
|
||||
target:
|
||||
type: Utilization
|
||||
averageUtilization: 80
|
||||
@@ -0,0 +1,70 @@
|
||||
---
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: orderservice
|
||||
spec:
|
||||
replicas: 1
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
app: orderservice
|
||||
annotations:
|
||||
prometheus.io/scrape: "true"
|
||||
prometheus.io/path: "/metrics"
|
||||
prometheus.io/port: "80"
|
||||
spec:
|
||||
containers:
|
||||
- name: orderservice
|
||||
image: orderservice:latest
|
||||
ports:
|
||||
- containerPort: 80
|
||||
env:
|
||||
- name: ASPNETCORE_URLS
|
||||
value: http://*:80
|
||||
resources:
|
||||
requests:
|
||||
memory: "128Mi"
|
||||
cpu: "150m"
|
||||
limits:
|
||||
memory: "256Mi"
|
||||
cpu: "200m"
|
||||
selector:
|
||||
matchLabels:
|
||||
app: orderservice
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: orderservice
|
||||
labels:
|
||||
app: orderservice
|
||||
spec:
|
||||
type: LoadBalancer
|
||||
ports:
|
||||
- port: 8080
|
||||
targetPort: 80
|
||||
nodePort: 32001
|
||||
name: orderport
|
||||
selector:
|
||||
app: orderservice
|
||||
|
||||
---
|
||||
apiVersion: autoscaling/v2
|
||||
kind: HorizontalPodAutoscaler
|
||||
metadata:
|
||||
name: orderservice-hpa
|
||||
spec:
|
||||
scaleTargetRef:
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
name: orderservice
|
||||
minReplicas: 1
|
||||
maxReplicas: 3
|
||||
metrics:
|
||||
- type: Resource
|
||||
resource:
|
||||
name: cpu
|
||||
target:
|
||||
type: Utilization
|
||||
averageUtilization: 80
|
||||
@@ -0,0 +1,70 @@
|
||||
---
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: paymentservice
|
||||
spec:
|
||||
replicas: 1
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
app: paymentservice
|
||||
annotations:
|
||||
prometheus.io/scrape: "true"
|
||||
prometheus.io/path: "/metrics"
|
||||
prometheus.io/port: "80"
|
||||
spec:
|
||||
containers:
|
||||
- name: paymentservice
|
||||
image: paymentservice:latest
|
||||
ports:
|
||||
- containerPort: 80
|
||||
env:
|
||||
- name: ASPNETCORE_URLS
|
||||
value: http://*:80
|
||||
resources:
|
||||
requests:
|
||||
memory: "128Mi"
|
||||
cpu: "150m"
|
||||
limits:
|
||||
memory: "256Mi"
|
||||
cpu: "200m"
|
||||
selector:
|
||||
matchLabels:
|
||||
app: paymentservice
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: paymentservice
|
||||
labels:
|
||||
app: paymentservice
|
||||
spec:
|
||||
type: LoadBalancer
|
||||
ports:
|
||||
- port: 8082
|
||||
targetPort: 80
|
||||
nodePort: 32005
|
||||
name: paymentport
|
||||
selector:
|
||||
app: paymentservice
|
||||
|
||||
---
|
||||
apiVersion: autoscaling/v2
|
||||
kind: HorizontalPodAutoscaler
|
||||
metadata:
|
||||
name: paymentservice-hpa
|
||||
spec:
|
||||
scaleTargetRef:
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
name: paymentservice
|
||||
minReplicas: 1
|
||||
maxReplicas: 3
|
||||
metrics:
|
||||
- type: Resource
|
||||
resource:
|
||||
name: cpu
|
||||
target:
|
||||
type: Utilization
|
||||
averageUtilization: 80
|
||||
@@ -0,0 +1,57 @@
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
# Creating a new service to expose the existing one.
|
||||
# This avoids modifying the original service managed by a package manager like Helm.
|
||||
name: prometheus-grafana-external
|
||||
namespace: monitoring
|
||||
labels:
|
||||
app.kubernetes.io/name: grafana-external
|
||||
spec:
|
||||
# Exposes the Service externally using a cloud provider's load balancer.
|
||||
type: LoadBalancer
|
||||
ports:
|
||||
- name: http
|
||||
# The port the service is exposed on externally and internally.
|
||||
# The load balancer will forward traffic from this port.
|
||||
port: 9000
|
||||
# The port on the pod that the service forwards traffic to.
|
||||
# Based on your original command, this is likely 3000 for Grafana.
|
||||
targetPort: 3000
|
||||
protocol: TCP
|
||||
# This selector is crucial. It must match the labels of the pods you want to target.
|
||||
# The 'prometheus-grafana' service likely targets pods with a label like this.
|
||||
# Please verify the correct labels for your Grafana pods.
|
||||
selector:
|
||||
app.kubernetes.io/instance: prometheus
|
||||
app.kubernetes.io/name: grafana
|
||||
|
||||
---
|
||||
|
||||
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
# Creating a new service to avoid modifying the original one.
|
||||
name: prometheus-external
|
||||
namespace: monitoring
|
||||
labels:
|
||||
app.kubernetes.io/name: prometheus-external
|
||||
spec:
|
||||
# This type will provision an external load balancer.
|
||||
type: LoadBalancer
|
||||
ports:
|
||||
- name: http-prometheus
|
||||
protocol: TCP
|
||||
# The external port the load balancer will listen on.
|
||||
port: 9090
|
||||
# The port on the Prometheus pods to forward traffic to.
|
||||
targetPort: 9090
|
||||
# This selector is crucial. It tells the service which pods to send traffic to.
|
||||
# For the kube-prometheus stack, the pods are typically labeled like this.
|
||||
# Please verify this matches your setup.
|
||||
selector:
|
||||
app.kubernetes.io/name: prometheus
|
||||
# It's possible an instance label is also required, such as:
|
||||
# app.kubernetes.io/instance: prometheus-kube-prometheus-prometheus
|
||||
# Add it to the selector if your pods have it.
|
||||
@@ -0,0 +1,38 @@
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: rabbitmq-service
|
||||
spec:
|
||||
selector:
|
||||
app: rabbitmq
|
||||
ports:
|
||||
- protocol: TCP
|
||||
port: 5672
|
||||
targetPort: 5672
|
||||
---
|
||||
apiVersion: apps/v1
|
||||
kind: StatefulSet
|
||||
metadata:
|
||||
name: rabbitmq
|
||||
spec:
|
||||
serviceName: "rabbitmq-service"
|
||||
replicas: 1
|
||||
selector:
|
||||
matchLabels:
|
||||
app: rabbitmq
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
app: rabbitmq
|
||||
spec:
|
||||
containers:
|
||||
- name: rabbitmq
|
||||
image: rabbitmq:3-management
|
||||
ports:
|
||||
- containerPort: 5672
|
||||
- containerPort: 15672
|
||||
env:
|
||||
- name: RABBITMQ_DEFAULT_USER
|
||||
value: "user"
|
||||
- name: RABBITMQ_DEFAULT_PASS
|
||||
value: "password"
|
||||
@@ -0,0 +1,43 @@
|
||||
apiVersion: monitoring.coreos.com/v1
|
||||
kind: ServiceMonitor
|
||||
metadata:
|
||||
name: inventoryservice-servicemonitor
|
||||
labels:
|
||||
release: prometheus # Ensure this label matches your Prometheus Operator release
|
||||
spec:
|
||||
selector:
|
||||
matchLabels:
|
||||
app: inventoryservice
|
||||
endpoints:
|
||||
- port: inventoryport
|
||||
path: /metrics
|
||||
|
||||
---
|
||||
|
||||
apiVersion: monitoring.coreos.com/v1
|
||||
kind: ServiceMonitor
|
||||
metadata:
|
||||
name: orderservice-servicemonitor
|
||||
labels:
|
||||
release: prometheus # Ensure this label matches your Prometheus Operator release
|
||||
spec:
|
||||
selector:
|
||||
matchLabels:
|
||||
app: orderservice
|
||||
endpoints:
|
||||
- port: orderport
|
||||
path: /metrics
|
||||
---
|
||||
apiVersion: monitoring.coreos.com/v1
|
||||
kind: ServiceMonitor
|
||||
metadata:
|
||||
name: paymentservice-servicemonitor
|
||||
labels:
|
||||
release: prometheus # Ensure this label matches your Prometheus Operator release
|
||||
spec:
|
||||
selector:
|
||||
matchLabels:
|
||||
app: paymentservice
|
||||
endpoints:
|
||||
- port: paymentport
|
||||
path: /metrics
|
||||
@@ -0,0 +1,70 @@
|
||||
kind: PersistentVolumeClaim
|
||||
apiVersion: v1
|
||||
metadata:
|
||||
name: mssql-data
|
||||
spec:
|
||||
accessModes:
|
||||
- ReadWriteOnce
|
||||
resources:
|
||||
requests:
|
||||
storage: 8Gi
|
||||
---
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: mssql-deployment
|
||||
spec:
|
||||
replicas: 1
|
||||
selector:
|
||||
matchLabels:
|
||||
app: mssql
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
app: mssql
|
||||
spec:
|
||||
terminationGracePeriodSeconds: 30
|
||||
hostname: mssqlinst
|
||||
securityContext:
|
||||
fsGroup: 10001
|
||||
containers:
|
||||
- name: mssql
|
||||
image: mcr.microsoft.com/mssql/server:2022-latest
|
||||
resources:
|
||||
requests:
|
||||
memory: "2G"
|
||||
cpu: "2000m"
|
||||
limits:
|
||||
memory: "2G"
|
||||
cpu: "2000m"
|
||||
ports:
|
||||
- containerPort: 1433
|
||||
env:
|
||||
- name: MSSQL_PID
|
||||
value: "Developer"
|
||||
- name: ACCEPT_EULA
|
||||
value: "Y"
|
||||
- name: MSSQL_SA_PASSWORD
|
||||
value: "TestPass123!"
|
||||
volumeMounts:
|
||||
- name: mssqldb
|
||||
mountPath: /var/opt/mssql
|
||||
|
||||
volumes:
|
||||
- name: mssqldb
|
||||
persistentVolumeClaim:
|
||||
claimName: mssql-data
|
||||
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: mssql-deployment
|
||||
spec:
|
||||
selector:
|
||||
app: mssql
|
||||
ports:
|
||||
- protocol: TCP
|
||||
port: 1433
|
||||
targetPort: 1433
|
||||
type: LoadBalancer
|
||||
Reference in New Issue
Block a user