diff --git a/kubernetes/services/api-gateway.yaml b/kubernetes/services/api-gateway.yaml index 90ef32c95..88f30de64 100644 --- a/kubernetes/services/api-gateway.yaml +++ b/kubernetes/services/api-gateway.yaml @@ -82,6 +82,12 @@ spec: - image: api_gateway:v1.0 name: apimanager-web imagePullPolicy: IfNotPresent + # The value is determined according to the actual situation, the following value is for the deployment on AWS + resources: + limits: + cpu: 500m + requests: + cpu: 200m command: ["java", "-jar", "/app/AlcorApiGateway-0.1.0.jar", "--spring.config.location=/etc/api/application.properties"] ports: - containerPort: 8080 diff --git a/kubernetes/services/api-gateway_hpa.yaml b/kubernetes/services/api-gateway_hpa.yaml new file mode 100644 index 000000000..3982ee801 --- /dev/null +++ b/kubernetes/services/api-gateway_hpa.yaml @@ -0,0 +1,79 @@ +apiVersion: autoscaling/v2beta2 +kind: HorizontalPodAutoscaler +metadata: + name: apimanager-hpa +spec: + scaleTargetRef: + apiVersion: apps/v1 + kind: Deployment + name: apimanager + # if minReplicas is less than Deployment replicas value, it may cause scale down + minReplicas: 5 + maxReplicas: 10 + behavior: + scaleDown: + # Indicates that the stability window considers the expected state of the past (here within 300 sec) to prevent expansion and contraction + stabilizationWindowSeconds: 300 + policies: + - type: Percent + value: 100 + periodSeconds: 15 + # The autoscaler will choose the strategy that affects the minimum number of Pods + selectPolicy: Min + scaleUp: + stabilizationWindowSeconds: 0 + policies: + - type: Percent + value: 100 + periodSeconds: 15 + - type: Pods + value: 4 + periodSeconds: 15 + selectPolicy: Max + metrics: +# Set the average usage rate of the cpu, scale up if it exceeds 50 + - type: Resource + resource: + name: cpu + target: + type: Utilization + averageUtilization: 50 +# The average data volume per second reaches 1000 for scaling up +# - type: Pods +# pods: +# metric: +# name: packets-per-second +# target: +# type: AverageValue +# averageValue: 1k + +# The value is derived from Ingress "main-route", scale up when the number of requests per second in Ingress reaches 2000 +# - type: Object +# object: +# metric: +# name: requests-per-second +# describedObject: +# apiVersion: networking.k8s.io/v1beta1 +# kind: Ingress +# name: main-route +# target: +# kind: Value +# value: 10k + +# HPA's current status data +status: + currentReplicas: 1 + desiredReplicas: 1 + conditions: + - status: "True" + type: "True" +# - type: Object +# object: +# metric: +# name: requests-per-second +# describedObject: +# apiVersion: networking.k8s.io/v1beta1 +# kind: Ingress +# name: main-route +# current: +# value: 10k diff --git a/kubernetes/services/deleteYaml.sh b/kubernetes/services/deleteYaml.sh index e3cb206a4..7f506ade0 100644 --- a/kubernetes/services/deleteYaml.sh +++ b/kubernetes/services/deleteYaml.sh @@ -51,58 +51,72 @@ if [[ "$OSTYPE" == "linux-gnu" ]]; then kubectl delete configmap sg-configmap kubectl delete services sgmanager-service kubectl delete deployment sgmanager + kubectl delete hpa sgmanager-hpa kubectl delete configmap vpc-configmap kubectl delete services vpcmanager-service kubectl delete deployment vpcmanager + kubectl delete hpa vpcmanager-hpa kubectl delete configmap subnet-configmap kubectl delete services subnetmanager-service kubectl delete deployment subnetmanager + kubectl delete hpa subnetmanager-hpa kubectl delete configmap route-configmap kubectl delete services routemanager-service kubectl delete deployment routemanager + kubectl delete hpa routemanager-hpa kubectl delete configmap mac-configmap kubectl delete services macmanager-service kubectl delete deployment macmanager + kubectl delete hpa macmanager-hpa kubectl delete configmap ip-configmap kubectl delete services ipmanager-service kubectl delete deployment ipmanager + kubectl delete hpa ipmanager-hpa kubectl delete configmap port-configmap kubectl delete services portmanager-service kubectl delete deployment portmanager + kubectl delete hpa portmanager-hpa kubectl delete configmap quota-configmap kubectl delete services quotamanager-service kubectl delete deployment quotamanager + kubectl delete hpa quotamanager-hpa kubectl delete configmap node-configmap kubectl delete services nodemanager-service kubectl delete deployment nodemanager + kubectl delete hpa nodemanager-hpa kubectl delete configmap api-configmap kubectl delete services apimanager-service kubectl delete deployment apimanager + kubectl delete hpa apimanager-hpa kubectl delete configmap dpm-configmap kubectl delete services dataplanemanager-service kubectl delete deployment dataplanemanager + kubectl delete hpa dataplanemanager-hpa kubectl delete configmap eip-configmap kubectl delete services eipmanager-service kubectl delete deployment eipmanager + kubectl delete hpa eipmanager-hpa kubectl delete configmap ncm-configmap kubectl delete services netwconfigmanager-service kubectl delete deployment netwconfigmanager + kubectl delete hpa netwconfigmanager-hpa kubectl delete configmap gateway-configmap kubectl delete services gatewaymanager-service kubectl delete deployment gatewaymanager + kubectl delete hpa gatewaymanager-hpa elif [[ "$OSTYPE" == "darwin"* ]]; then diff --git a/kubernetes/services/dpm_manager.yaml b/kubernetes/services/dpm_manager.yaml index da62e616b..200017d21 100644 --- a/kubernetes/services/dpm_manager.yaml +++ b/kubernetes/services/dpm_manager.yaml @@ -80,6 +80,12 @@ spec: #- image: fwnetworking/controller:dpm_manager-v0.3.0 name: dataplanemanager-web imagePullPolicy: IfNotPresent + # The value is determined according to the actual situation, the following value is for the deployment on AWS + resources: + limits: + cpu: 500m + requests: + cpu: 200m command: ["java", "-jar", "/app/AlcorDataPlaneManager-0.1.0.jar", "--spring.config.location=/etc/dpm/application.properties"] ports: - containerPort: 8080 diff --git a/kubernetes/services/dpm_manager_hpa.yaml b/kubernetes/services/dpm_manager_hpa.yaml new file mode 100644 index 000000000..878a81ba6 --- /dev/null +++ b/kubernetes/services/dpm_manager_hpa.yaml @@ -0,0 +1,79 @@ +apiVersion: autoscaling/v2beta2 +kind: HorizontalPodAutoscaler +metadata: + name: dataplanemanager-hpa +spec: + scaleTargetRef: + apiVersion: apps/v1 + kind: Deployment + name: dataplanemanager + # if minReplicas is less than Deployment replicas value, it may cause scale down + minReplicas: 5 + maxReplicas: 10 + behavior: + scaleDown: + # Indicates that the stability window considers the expected state of the past (here within 300 sec) to prevent expansion and contraction + stabilizationWindowSeconds: 300 + policies: + - type: Percent + value: 100 + periodSeconds: 15 + # The autoscaler will choose the strategy that affects the minimum number of Pods + selectPolicy: Min + scaleUp: + stabilizationWindowSeconds: 0 + policies: + - type: Percent + value: 100 + periodSeconds: 15 + - type: Pods + value: 4 + periodSeconds: 15 + selectPolicy: Max + metrics: +# Set the average usage rate of the cpu, scale up if it exceeds 50 + - type: Resource + resource: + name: cpu + target: + type: Utilization + averageUtilization: 50 +# The average data volume per second reaches 1000 for scaling up +# - type: Pods +# pods: +# metric: +# name: packets-per-second +# target: +# type: AverageValue +# averageValue: 1k + +# The value is derived from Ingress "main-route", scale up when the number of requests per second in Ingress reaches 2000 +# - type: Object +# object: +# metric: +# name: requests-per-second +# describedObject: +# apiVersion: networking.k8s.io/v1beta1 +# kind: Ingress +# name: main-route +# target: +# kind: Value +# value: 10k + +# HPA's current status data +status: + currentReplicas: 1 + desiredReplicas: 1 + conditions: + - status: "True" + type: "True" +# - type: Object +# object: +# metric: +# name: requests-per-second +# describedObject: +# apiVersion: networking.k8s.io/v1beta1 +# kind: Ingress +# name: main-route +# current: +# value: 10k diff --git a/kubernetes/services/elastic_ip_manager.yaml b/kubernetes/services/elastic_ip_manager.yaml index 60084d9ba..0b581fbd6 100644 --- a/kubernetes/services/elastic_ip_manager.yaml +++ b/kubernetes/services/elastic_ip_manager.yaml @@ -47,6 +47,12 @@ spec: #- image: fwnetworking/controller:mac_manager-v0.3.0 name: eipmanager-web imagePullPolicy: IfNotPresent + # The value is determined according to the actual situation, the following value is for the deployment on AWS + resources: + limits: + cpu: 500m + requests: + cpu: 200m command: ["java", "-jar", "/app/AlcorElasticIpManager-0.1.0.jar", "--spring.config.location=/etc/eip/application.properties"] ports: - containerPort: 8080 diff --git a/kubernetes/services/elastic_ip_manager_hpa.yaml b/kubernetes/services/elastic_ip_manager_hpa.yaml new file mode 100644 index 000000000..1672fe97c --- /dev/null +++ b/kubernetes/services/elastic_ip_manager_hpa.yaml @@ -0,0 +1,79 @@ +apiVersion: autoscaling/v2beta2 +kind: HorizontalPodAutoscaler +metadata: + name: eipmanager-hpa +spec: + scaleTargetRef: + apiVersion: apps/v1 + kind: Deployment + name: eipmanager + # if minReplicas is less than Deployment replicas value, it may cause scale down + minReplicas: 5 + maxReplicas: 10 + behavior: + scaleDown: + # Indicates that the stability window considers the expected state of the past (here within 300 sec) to prevent expansion and contraction + stabilizationWindowSeconds: 300 + policies: + - type: Percent + value: 100 + periodSeconds: 15 + # The autoscaler will choose the strategy that affects the minimum number of Pods + selectPolicy: Min + scaleUp: + stabilizationWindowSeconds: 0 + policies: + - type: Percent + value: 100 + periodSeconds: 15 + - type: Pods + value: 4 + periodSeconds: 15 + selectPolicy: Max + metrics: +# Set the average usage rate of the cpu, scale up if it exceeds 50 + - type: Resource + resource: + name: cpu + target: + type: Utilization + averageUtilization: 50 +# The average data volume per second reaches 1000 for scaling up +# - type: Pods +# pods: +# metric: +# name: packets-per-second +# target: +# type: AverageValue +# averageValue: 1k + +# The value is derived from Ingress "main-route", scale up when the number of requests per second in Ingress reaches 2000 +# - type: Object +# object: +# metric: +# name: requests-per-second +# describedObject: +# apiVersion: networking.k8s.io/v1beta1 +# kind: Ingress +# name: main-route +# target: +# kind: Value +# value: 10k + +# HPA's current status data +status: + currentReplicas: 1 + desiredReplicas: 1 + conditions: + - status: "True" + type: "True" +# - type: Object +# object: +# metric: +# name: requests-per-second +# describedObject: +# apiVersion: networking.k8s.io/v1beta1 +# kind: Ingress +# name: main-route +# current: +# value: 10k diff --git a/kubernetes/services/gateway_manager.yaml b/kubernetes/services/gateway_manager.yaml index 7bf698e80..ee0f18834 100644 --- a/kubernetes/services/gateway_manager.yaml +++ b/kubernetes/services/gateway_manager.yaml @@ -55,6 +55,12 @@ spec: #- image: fwnetworking/controller:gateway_manager-v0.3.0 name: gatewaymanager-web imagePullPolicy: IfNotPresent + # The value is determined according to the actual situation, the following value is for the deployment on AWS + resources: + limits: + cpu: 500m + requests: + cpu: 200m command: ["java", "-jar", "/app/AlcorGatewayManager-0.1.0.jar", "--spring.config.location=/etc/app/application.properties"] ports: - containerPort: 8080 diff --git a/kubernetes/services/gateway_manager_hpa.yaml b/kubernetes/services/gateway_manager_hpa.yaml new file mode 100644 index 000000000..bf466dd4e --- /dev/null +++ b/kubernetes/services/gateway_manager_hpa.yaml @@ -0,0 +1,79 @@ +apiVersion: autoscaling/v2beta2 +kind: HorizontalPodAutoscaler +metadata: + name: gatewaymanager-hpa +spec: + scaleTargetRef: + apiVersion: apps/v1 + kind: Deployment + name: gatewaymanager + # if minReplicas is less than Deployment replicas value, it may cause scale down + minReplicas: 5 + maxReplicas: 10 + behavior: + scaleDown: + # Indicates that the stability window considers the expected state of the past (here within 300 sec) to prevent expansion and contraction + stabilizationWindowSeconds: 300 + policies: + - type: Percent + value: 100 + periodSeconds: 15 + # The autoscaler will choose the strategy that affects the minimum number of Pods + selectPolicy: Min + scaleUp: + stabilizationWindowSeconds: 0 + policies: + - type: Percent + value: 100 + periodSeconds: 15 + - type: Pods + value: 4 + periodSeconds: 15 + selectPolicy: Max + metrics: +# Set the average usage rate of the cpu, scale up if it exceeds 50 + - type: Resource + resource: + name: cpu + target: + type: Utilization + averageUtilization: 50 +# The average data volume per second reaches 1000 for scaling up +# - type: Pods +# pods: +# metric: +# name: packets-per-second +# target: +# type: AverageValue +# averageValue: 1k + +# The value is derived from Ingress "main-route", scale up when the number of requests per second in Ingress reaches 2000 +# - type: Object +# object: +# metric: +# name: requests-per-second +# describedObject: +# apiVersion: networking.k8s.io/v1beta1 +# kind: Ingress +# name: main-route +# target: +# kind: Value +# value: 10k + +# HPA's current status data +status: + currentReplicas: 1 + desiredReplicas: 1 + conditions: + - status: "True" + type: "True" +# - type: Object +# object: +# metric: +# name: requests-per-second +# describedObject: +# apiVersion: networking.k8s.io/v1beta1 +# kind: Ingress +# name: main-route +# current: +# value: 10k diff --git a/kubernetes/services/mac_manager.yaml b/kubernetes/services/mac_manager.yaml index 2fb3f8040..da24e2792 100644 --- a/kubernetes/services/mac_manager.yaml +++ b/kubernetes/services/mac_manager.yaml @@ -56,6 +56,12 @@ spec: #- image: fwnetworking/controller:mac_manager-v0.3.0 name: macmanager-web imagePullPolicy: IfNotPresent + # The value is determined according to the actual situation, the following value is for the deployment on AWS + resources: + limits: + cpu: 500m + requests: + cpu: 200m command: ["java", "-jar", "/app/AlcorMacManager-0.1.0.jar", "--spring.config.location=/etc/mac/application.properties"] ports: - containerPort: 8080 diff --git a/kubernetes/services/mac_manager_hpa.yaml b/kubernetes/services/mac_manager_hpa.yaml new file mode 100644 index 000000000..343569bd6 --- /dev/null +++ b/kubernetes/services/mac_manager_hpa.yaml @@ -0,0 +1,79 @@ +apiVersion: autoscaling/v2beta2 +kind: HorizontalPodAutoscaler +metadata: + name: macmanager-hpa +spec: + scaleTargetRef: + apiVersion: apps/v1 + kind: Deployment + name: macmanager + # if minReplicas is less than Deployment replicas value, it may cause scale down + minReplicas: 5 + maxReplicas: 10 + behavior: + scaleDown: + # Indicates that the stability window considers the expected state of the past (here within 300 sec) to prevent expansion and contraction + stabilizationWindowSeconds: 300 + policies: + - type: Percent + value: 100 + periodSeconds: 15 + # The autoscaler will choose the strategy that affects the minimum number of Pods + selectPolicy: Min + scaleUp: + stabilizationWindowSeconds: 0 + policies: + - type: Percent + value: 100 + periodSeconds: 15 + - type: Pods + value: 4 + periodSeconds: 15 + selectPolicy: Max + metrics: +# Set the average usage rate of the cpu, scale up if it exceeds 50 + - type: Resource + resource: + name: cpu + target: + type: Utilization + averageUtilization: 50 +# The average data volume per second reaches 1000 for scaling up +# - type: Pods +# pods: +# metric: +# name: packets-per-second +# target: +# type: AverageValue +# averageValue: 1k + +# The value is derived from Ingress "main-route", scale up when the number of requests per second in Ingress reaches 2000 +# - type: Object +# object: +# metric: +# name: requests-per-second +# describedObject: +# apiVersion: networking.k8s.io/v1beta1 +# kind: Ingress +# name: main-route +# target: +# kind: Value +# value: 10k + +# HPA's current status data +status: + currentReplicas: 1 + desiredReplicas: 1 + conditions: + - status: "True" + type: "True" +# - type: Object +# object: +# metric: +# name: requests-per-second +# describedObject: +# apiVersion: networking.k8s.io/v1beta1 +# kind: Ingress +# name: main-route +# current: +# value: 10k diff --git a/kubernetes/services/metrics-server.yaml b/kubernetes/services/metrics-server.yaml new file mode 100644 index 000000000..098805eaa --- /dev/null +++ b/kubernetes/services/metrics-server.yaml @@ -0,0 +1,209 @@ +# Metrics Server has specific requirements for cluster and network configuration. These requirements aren't the default for all cluster distributions. Please ensure that your cluster distribution supports these requirements before using Metrics Server: + +# 1. Metrics Server must be reachable from kube-apiserver by container IP address (or node IP if hostNetwork is enabled). + +# 2. The kube-apiserver must enable an aggregation layer. + +# 3. Nodes must have Webhook authentication and authorization enabled. + +# 4. Kubelet certificate needs to be signed by cluster Certificate Authority (or disable certificate validation by passing --kubelet-insecure-tls to Metrics Server) + +# 5. Container runtime must implement a container metrics RPCs (or have cAdvisor support) + +# Please look at the link https://github.com/kubernetes-sigs/metrics-server#requirements for reference + +# Latest Metrics Server release can be installed by running: +# kubectl apply -f https://github.com/kubernetes-sigs/metrics-server/releases/latest/download/components.yaml +apiVersion: v1 +kind: ServiceAccount +metadata: + labels: + k8s-app: metrics-server + name: metrics-server + namespace: kube-system +--- +apiVersion: rbac.authorization.k8s.io/v1 +kind: ClusterRole +metadata: + labels: + k8s-app: metrics-server + rbac.authorization.k8s.io/aggregate-to-admin: "true" + rbac.authorization.k8s.io/aggregate-to-edit: "true" + rbac.authorization.k8s.io/aggregate-to-view: "true" + name: system:aggregated-metrics-reader +rules: + - apiGroups: + - metrics.k8s.io + resources: + - pods + - nodes + verbs: + - get + - list + - watch +--- +apiVersion: rbac.authorization.k8s.io/v1 +kind: ClusterRole +metadata: + labels: + k8s-app: metrics-server + name: system:metrics-server +rules: + - apiGroups: + - "" + resources: + - pods + - nodes + - nodes/stats + - namespaces + - configmaps + verbs: + - get + - list + - watch +--- +apiVersion: rbac.authorization.k8s.io/v1 +kind: RoleBinding +metadata: + labels: + k8s-app: metrics-server + name: metrics-server-auth-reader + namespace: kube-system +roleRef: + apiGroup: rbac.authorization.k8s.io + kind: Role + name: extension-apiserver-authentication-reader +subjects: + - kind: ServiceAccount + name: metrics-server + namespace: kube-system +--- +apiVersion: rbac.authorization.k8s.io/v1 +kind: ClusterRoleBinding +metadata: + labels: + k8s-app: metrics-server + name: metrics-server:system:auth-delegator +roleRef: + apiGroup: rbac.authorization.k8s.io + kind: ClusterRole + name: system:auth-delegator +subjects: + - kind: ServiceAccount + name: metrics-server + namespace: kube-system +--- +apiVersion: rbac.authorization.k8s.io/v1 +kind: ClusterRoleBinding +metadata: + labels: + k8s-app: metrics-server + name: system:metrics-server +roleRef: + apiGroup: rbac.authorization.k8s.io + kind: ClusterRole + name: system:metrics-server +subjects: + - kind: ServiceAccount + name: metrics-server + namespace: kube-system +--- +apiVersion: v1 +kind: Service +metadata: + labels: + k8s-app: metrics-server + name: metrics-server + namespace: kube-system +spec: + ports: + - name: https + port: 443 + protocol: TCP + targetPort: https + selector: + k8s-app: metrics-server +--- +apiVersion: apps/v1 +kind: Deployment +metadata: + labels: + k8s-app: metrics-server + name: metrics-server + namespace: kube-system +spec: + selector: + matchLabels: + k8s-app: metrics-server + strategy: + rollingUpdate: + maxUnavailable: 0 + template: + metadata: + labels: + k8s-app: metrics-server + spec: + containers: + - args: + - --cert-dir=/tmp + - --secure-port=443 + - --kubelet-preferred-address-types=InternalIP,ExternalIP,Hostname + - --kubelet-use-node-status-port + - --kubelet-insecure-tls + - --metric-resolution=15s + image: k8s.gcr.io/metrics-server/metrics-server:v0.5.0 + imagePullPolicy: IfNotPresent + livenessProbe: + failureThreshold: 3 + httpGet: + path: /livez + port: https + scheme: HTTPS + periodSeconds: 10 + name: metrics-server + ports: + - containerPort: 443 + name: https + protocol: TCP + readinessProbe: + failureThreshold: 3 + httpGet: + path: /readyz + port: https + scheme: HTTPS + initialDelaySeconds: 20 + periodSeconds: 10 + resources: + requests: + cpu: 100m + memory: 200Mi + securityContext: + readOnlyRootFilesystem: true + runAsNonRoot: true + runAsUser: 1000 + volumeMounts: + - mountPath: /tmp + name: tmp-dir + nodeSelector: + kubernetes.io/os: linux + priorityClassName: system-cluster-critical + serviceAccountName: metrics-server + volumes: + - emptyDir: {} + name: tmp-dir +--- +apiVersion: apiregistration.k8s.io/v1 +kind: APIService +metadata: + labels: + k8s-app: metrics-server + name: v1beta1.metrics.k8s.io +spec: + group: metrics.k8s.io + groupPriorityMinimum: 100 + insecureSkipTLSVerify: true + service: + name: metrics-server + namespace: kube-system + version: v1beta1 + versionPriority: 100 diff --git a/kubernetes/services/network_config_manager.yaml b/kubernetes/services/network_config_manager.yaml index 5703377e4..fd3e28a09 100644 --- a/kubernetes/services/network_config_manager.yaml +++ b/kubernetes/services/network_config_manager.yaml @@ -67,6 +67,12 @@ spec: - image: network_config_manager:v1.0 name: networkconfigmanager-web imagePullPolicy: IfNotPresent + # The value is determined according to the actual situation, the following value is for the deployment on AWS + resources: + limits: + cpu: 500m + requests: + cpu: 200m command: ["java", "-jar", "/app/AlcorNetworkConfigManager-0.1.0.jar", "--spring.config.location=/etc/ncm/application.properties"] ports: - containerPort: 8080 diff --git a/kubernetes/services/network_config_manager_hpa.yaml b/kubernetes/services/network_config_manager_hpa.yaml new file mode 100644 index 000000000..c016b374f --- /dev/null +++ b/kubernetes/services/network_config_manager_hpa.yaml @@ -0,0 +1,79 @@ +apiVersion: autoscaling/v2beta2 +kind: HorizontalPodAutoscaler +metadata: + name: netwconfigmanager-hpa +spec: + scaleTargetRef: + apiVersion: apps/v1 + kind: Deployment + name: netwconfigmanager + # if minReplicas is less than Deployment replicas value, it may cause scale down + minReplicas: 5 + maxReplicas: 10 + behavior: + scaleDown: + # Indicates that the stability window considers the expected state of the past (here within 300 sec) to prevent expansion and contraction + stabilizationWindowSeconds: 300 + policies: + - type: Percent + value: 100 + periodSeconds: 15 + # The autoscaler will choose the strategy that affects the minimum number of Pods + selectPolicy: Min + scaleUp: + stabilizationWindowSeconds: 0 + policies: + - type: Percent + value: 100 + periodSeconds: 15 + - type: Pods + value: 4 + periodSeconds: 15 + selectPolicy: Max + metrics: +# Set the average usage rate of the cpu, scale up if it exceeds 50 + - type: Resource + resource: + name: cpu + target: + type: Utilization + averageUtilization: 50 +# The average data volume per second reaches 1000 for scaling up +# - type: Pods +# pods: +# metric: +# name: packets-per-second +# target: +# type: AverageValue +# averageValue: 1k + +# The value is derived from Ingress "main-route", scale up when the number of requests per second in Ingress reaches 2000 +# - type: Object +# object: +# metric: +# name: requests-per-second +# describedObject: +# apiVersion: networking.k8s.io/v1beta1 +# kind: Ingress +# name: main-route +# target: +# kind: Value +# value: 10k + +# HPA's current status data +status: + currentReplicas: 1 + desiredReplicas: 1 + conditions: + - status: "True" + type: "True" +# - type: Object +# object: +# metric: +# name: requests-per-second +# describedObject: +# apiVersion: networking.k8s.io/v1beta1 +# kind: Ingress +# name: main-route +# current: +# value: 10k diff --git a/kubernetes/services/node_manager.yaml b/kubernetes/services/node_manager.yaml index 27d033093..d0c738df3 100644 --- a/kubernetes/services/node_manager.yaml +++ b/kubernetes/services/node_manager.yaml @@ -59,6 +59,12 @@ spec: #- image: fwnetworking/controller:node_manager-v0.3.0 name: nodemanager-web imagePullPolicy: IfNotPresent + # The value is determined according to the actual situation, the following value is for the deployment on AWS + resources: + limits: + cpu: 500m + requests: + cpu: 200m command: ["java", "-jar", "/app/AlcorNodeManager-0.1.0.jar", "--spring.config.location=/etc/node/application.properties"] ports: - containerPort: 8080 diff --git a/kubernetes/services/node_manager_hpa.yaml b/kubernetes/services/node_manager_hpa.yaml new file mode 100644 index 000000000..f1b580405 --- /dev/null +++ b/kubernetes/services/node_manager_hpa.yaml @@ -0,0 +1,79 @@ +apiVersion: autoscaling/v2beta2 +kind: HorizontalPodAutoscaler +metadata: + name: nodemanager-hpa +spec: + scaleTargetRef: + apiVersion: apps/v1 + kind: Deployment + name: nodemanager + # if minReplicas is less than Deployment replicas value, it may cause scale down + minReplicas: 5 + maxReplicas: 10 + behavior: + scaleDown: + # Indicates that the stability window considers the expected state of the past (here within 300 sec) to prevent expansion and contraction + stabilizationWindowSeconds: 300 + policies: + - type: Percent + value: 100 + periodSeconds: 15 + # The autoscaler will choose the strategy that affects the minimum number of Pods + selectPolicy: Min + scaleUp: + stabilizationWindowSeconds: 0 + policies: + - type: Percent + value: 100 + periodSeconds: 15 + - type: Pods + value: 4 + periodSeconds: 15 + selectPolicy: Max + metrics: +# Set the average usage rate of the cpu, scale up if it exceeds 50 + - type: Resource + resource: + name: cpu + target: + type: Utilization + averageUtilization: 50 +# The average data volume per second reaches 1000 for scaling up +# - type: Pods +# pods: +# metric: +# name: packets-per-second +# target: +# type: AverageValue +# averageValue: 1k + +# The value is derived from Ingress "main-route", scale up when the number of requests per second in Ingress reaches 2000 +# - type: Object +# object: +# metric: +# name: requests-per-second +# describedObject: +# apiVersion: networking.k8s.io/v1beta1 +# kind: Ingress +# name: main-route +# target: +# kind: Value +# value: 10k + +# HPA's current status data +status: + currentReplicas: 1 + desiredReplicas: 1 + conditions: + - status: "True" + type: "True" +# - type: Object +# object: +# metric: +# name: requests-per-second +# describedObject: +# apiVersion: networking.k8s.io/v1beta1 +# kind: Ingress +# name: main-route +# current: +# value: 10k diff --git a/kubernetes/services/port_manager.yaml b/kubernetes/services/port_manager.yaml index 771572369..7aaa849c0 100644 --- a/kubernetes/services/port_manager.yaml +++ b/kubernetes/services/port_manager.yaml @@ -61,6 +61,12 @@ spec: #- image: fwnetworking/controller:port_manager-v0.3.0 name: portmanager-web imagePullPolicy: IfNotPresent + # The value is determined according to the actual situation, the following value is for the deployment on AWS + resources: + limits: + cpu: 500m + requests: + cpu: 200m command: ["java", "-jar", "/app/AlcorPortManager-0.1.0.jar", "--spring.config.location=/etc/port/application.properties"] ports: - containerPort: 8080 diff --git a/kubernetes/services/port_manager_hpa.yaml b/kubernetes/services/port_manager_hpa.yaml new file mode 100644 index 000000000..7d66e81a1 --- /dev/null +++ b/kubernetes/services/port_manager_hpa.yaml @@ -0,0 +1,79 @@ +apiVersion: autoscaling/v2beta2 +kind: HorizontalPodAutoscaler +metadata: + name: portmanager-hpa +spec: + scaleTargetRef: + apiVersion: apps/v1 + kind: Deployment + name: portmanager + # if minReplicas is less than Deployment replicas value, it may cause scale down + minReplicas: 5 + maxReplicas: 10 + behavior: + scaleDown: + # Indicates that the stability window considers the expected state of the past (here within 300 sec) to prevent expansion and contraction + stabilizationWindowSeconds: 300 + policies: + - type: Percent + value: 100 + periodSeconds: 15 + # The autoscaler will choose the strategy that affects the minimum number of Pods + selectPolicy: Min + scaleUp: + stabilizationWindowSeconds: 0 + policies: + - type: Percent + value: 100 + periodSeconds: 15 + - type: Pods + value: 4 + periodSeconds: 15 + selectPolicy: Max + metrics: +# Set the average usage rate of the cpu, scale up if it exceeds 50 + - type: Resource + resource: + name: cpu + target: + type: Utilization + averageUtilization: 50 +# The average data volume per second reaches 1000 for scaling up +# - type: Pods +# pods: +# metric: +# name: packets-per-second +# target: +# type: AverageValue +# averageValue: 1k + +# The value is derived from Ingress "main-route", scale up when the number of requests per second in Ingress reaches 2000 +# - type: Object +# object: +# metric: +# name: requests-per-second +# describedObject: +# apiVersion: networking.k8s.io/v1beta1 +# kind: Ingress +# name: main-route +# target: +# kind: Value +# value: 10k + +# HPA's current status data +status: + currentReplicas: 1 + desiredReplicas: 1 + conditions: + - status: "True" + type: "True" +# - type: Object +# object: +# metric: +# name: requests-per-second +# describedObject: +# apiVersion: networking.k8s.io/v1beta1 +# kind: Ingress +# name: main-route +# current: +# value: 10k diff --git a/kubernetes/services/private_ip_manager.yaml b/kubernetes/services/private_ip_manager.yaml index faac6e95f..e814ff32d 100644 --- a/kubernetes/services/private_ip_manager.yaml +++ b/kubernetes/services/private_ip_manager.yaml @@ -47,6 +47,12 @@ spec: #- image: fwnetworking/controller:ip_manager-v0.3.0 name: ipmanager-web imagePullPolicy: IfNotPresent + # The value is determined according to the actual situation, the following value is for the deployment on AWS + resources: + limits: + cpu: 500m + requests: + cpu: 200m command: ["java", "-jar", "/app/AlcorPrivateIpManager-0.1.0.jar", "--spring.config.location=/etc/ip/application.properties"] ports: - containerPort: 8080 diff --git a/kubernetes/services/private_ip_manager_hpa.yaml b/kubernetes/services/private_ip_manager_hpa.yaml new file mode 100644 index 000000000..4431c8e4e --- /dev/null +++ b/kubernetes/services/private_ip_manager_hpa.yaml @@ -0,0 +1,79 @@ +apiVersion: autoscaling/v2beta2 +kind: HorizontalPodAutoscaler +metadata: + name: ipmanager-hpa +spec: + scaleTargetRef: + apiVersion: apps/v1 + kind: Deployment + name: ipmanager + # if minReplicas is less than Deployment replicas value, it may cause scale down + minReplicas: 5 + maxReplicas: 10 + behavior: + scaleDown: + # Indicates that the stability window considers the expected state of the past (here within 300 sec) to prevent expansion and contraction + stabilizationWindowSeconds: 300 + policies: + - type: Percent + value: 100 + periodSeconds: 15 + # The autoscaler will choose the strategy that affects the minimum number of Pods + selectPolicy: Min + scaleUp: + stabilizationWindowSeconds: 0 + policies: + - type: Percent + value: 100 + periodSeconds: 15 + - type: Pods + value: 4 + periodSeconds: 15 + selectPolicy: Max + metrics: +# Set the average usage rate of the cpu, scale up if it exceeds 50 + - type: Resource + resource: + name: cpu + target: + type: Utilization + averageUtilization: 50 +# The average data volume per second reaches 1000 for scaling up +# - type: Pods +# pods: +# metric: +# name: packets-per-second +# target: +# type: AverageValue +# averageValue: 1k + +# The value is derived from Ingress "main-route", scale up when the number of requests per second in Ingress reaches 2000 +# - type: Object +# object: +# metric: +# name: requests-per-second +# describedObject: +# apiVersion: networking.k8s.io/v1beta1 +# kind: Ingress +# name: main-route +# target: +# kind: Value +# value: 10k + +# HPA's current status data +status: + currentReplicas: 1 + desiredReplicas: 1 + conditions: + - status: "True" + type: "True" +# - type: Object +# object: +# metric: +# name: requests-per-second +# describedObject: +# apiVersion: networking.k8s.io/v1beta1 +# kind: Ingress +# name: main-route +# current: +# value: 10k diff --git a/kubernetes/services/quota_manager.yaml b/kubernetes/services/quota_manager.yaml index 53e1f3035..1fc41bfe3 100644 --- a/kubernetes/services/quota_manager.yaml +++ b/kubernetes/services/quota_manager.yaml @@ -59,6 +59,12 @@ spec: #- image: fwnetworking/controller:vpc_manager-v0.3.0 name: quotamanager-web imagePullPolicy: IfNotPresent + # The value is determined according to the actual situation, the following value is for the deployment on AWS + resources: + limits: + cpu: 500m + requests: + cpu: 200m command: ["java", "-jar", "/app/AlcorQuotaManager-0.1.0.jar", "--spring.config.location=/opt/jboss/application.properties"] ports: - containerPort: 8080 diff --git a/kubernetes/services/quota_manager_hpa.yaml b/kubernetes/services/quota_manager_hpa.yaml new file mode 100644 index 000000000..90de3f7ee --- /dev/null +++ b/kubernetes/services/quota_manager_hpa.yaml @@ -0,0 +1,79 @@ +apiVersion: autoscaling/v2beta2 +kind: HorizontalPodAutoscaler +metadata: + name: quotamanager-hpa +spec: + scaleTargetRef: + apiVersion: apps/v1 + kind: Deployment + name: quotamanager + # if minReplicas is less than Deployment replicas value, it may cause scale down + minReplicas: 5 + maxReplicas: 10 + behavior: + scaleDown: + # Indicates that the stability window considers the expected state of the past (here within 300 sec) to prevent expansion and contraction + stabilizationWindowSeconds: 300 + policies: + - type: Percent + value: 100 + periodSeconds: 15 + # The autoscaler will choose the strategy that affects the minimum number of Pods + selectPolicy: Min + scaleUp: + stabilizationWindowSeconds: 0 + policies: + - type: Percent + value: 100 + periodSeconds: 15 + - type: Pods + value: 4 + periodSeconds: 15 + selectPolicy: Max + metrics: +# Set the average usage rate of the cpu, scale up if it exceeds 50 + - type: Resource + resource: + name: cpu + target: + type: Utilization + averageUtilization: 50 +# The average data volume per second reaches 1000 for scaling up +# - type: Pods +# pods: +# metric: +# name: packets-per-second +# target: +# type: AverageValue +# averageValue: 1k + +# The value is derived from Ingress "main-route", scale up when the number of requests per second in Ingress reaches 2000 +# - type: Object +# object: +# metric: +# name: requests-per-second +# describedObject: +# apiVersion: networking.k8s.io/v1beta1 +# kind: Ingress +# name: main-route +# target: +# kind: Value +# value: 10k + +# HPA's current status data +status: + currentReplicas: 1 + desiredReplicas: 1 + conditions: + - status: "True" + type: "True" +# - type: Object +# object: +# metric: +# name: requests-per-second +# describedObject: +# apiVersion: networking.k8s.io/v1beta1 +# kind: Ingress +# name: main-route +# current: +# value: 10k diff --git a/kubernetes/services/route_manager.yaml b/kubernetes/services/route_manager.yaml index 88a3b1876..6bd10ce35 100644 --- a/kubernetes/services/route_manager.yaml +++ b/kubernetes/services/route_manager.yaml @@ -55,6 +55,12 @@ spec: #- image: fwnetworking/controller:route_manager-v0.3.0 name: routemanager-web imagePullPolicy: IfNotPresent + # The value is determined according to the actual situation, the following value is for the deployment on AWS + resources: + limits: + cpu: 500m + requests: + cpu: 200m command: ["java", "-jar", "/app/AlcorRouteManager-0.1.0.jar", "--spring.config.location=/etc/app/application.properties"] ports: - containerPort: 8080 diff --git a/kubernetes/services/route_manager_hpa.yaml b/kubernetes/services/route_manager_hpa.yaml new file mode 100644 index 000000000..296a72e98 --- /dev/null +++ b/kubernetes/services/route_manager_hpa.yaml @@ -0,0 +1,79 @@ +apiVersion: autoscaling/v2beta2 +kind: HorizontalPodAutoscaler +metadata: + name: routemanager-hpa +spec: + scaleTargetRef: + apiVersion: apps/v1 + kind: Deployment + name: routemanager + # if minReplicas is less than Deployment replicas value, it may cause scale down + minReplicas: 5 + maxReplicas: 10 + behavior: + scaleDown: + # Indicates that the stability window considers the expected state of the past (here within 300 sec) to prevent expansion and contraction + stabilizationWindowSeconds: 300 + policies: + - type: Percent + value: 100 + periodSeconds: 15 + # The autoscaler will choose the strategy that affects the minimum number of Pods + selectPolicy: Min + scaleUp: + stabilizationWindowSeconds: 0 + policies: + - type: Percent + value: 100 + periodSeconds: 15 + - type: Pods + value: 4 + periodSeconds: 15 + selectPolicy: Max + metrics: +# Set the average usage rate of the cpu, scale up if it exceeds 50 + - type: Resource + resource: + name: cpu + target: + type: Utilization + averageUtilization: 50 +# The average data volume per second reaches 1000 for scaling up +# - type: Pods +# pods: +# metric: +# name: packets-per-second +# target: +# type: AverageValue +# averageValue: 1k + +# The value is derived from Ingress "main-route", scale up when the number of requests per second in Ingress reaches 2000 +# - type: Object +# object: +# metric: +# name: requests-per-second +# describedObject: +# apiVersion: networking.k8s.io/v1beta1 +# kind: Ingress +# name: main-route +# target: +# kind: Value +# value: 10k + +# HPA's current status data +status: + currentReplicas: 1 + desiredReplicas: 1 + conditions: + - status: "True" + type: "True" +# - type: Object +# object: +# metric: +# name: requests-per-second +# describedObject: +# apiVersion: networking.k8s.io/v1beta1 +# kind: Ingress +# name: main-route +# current: +# value: 10k diff --git a/kubernetes/services/sg_manager.yaml b/kubernetes/services/sg_manager.yaml index b6926a21e..614e3ec0a 100644 --- a/kubernetes/services/sg_manager.yaml +++ b/kubernetes/services/sg_manager.yaml @@ -47,6 +47,12 @@ spec: #- image: fwnetworking/controller:node_manager-v0.3.0 name: sgmanager-web imagePullPolicy: IfNotPresent + # The value is determined according to the actual situation, the following value is for the deployment on AWS + resources: + limits: + cpu: 500m + requests: + cpu: 200m command: ["java", "-jar", "/app/AlcorSecurityGroupManager-0.1.0.jar", "--spring.config.location=/etc/sg/application.properties"] ports: - containerPort: 8080 diff --git a/kubernetes/services/sg_manager_hpa.yaml b/kubernetes/services/sg_manager_hpa.yaml new file mode 100644 index 000000000..477a79dc6 --- /dev/null +++ b/kubernetes/services/sg_manager_hpa.yaml @@ -0,0 +1,79 @@ +apiVersion: autoscaling/v2beta2 +kind: HorizontalPodAutoscaler +metadata: + name: sgmanager-hpa +spec: + scaleTargetRef: + apiVersion: apps/v1 + kind: Deployment + name: sgmanager + # if minReplicas is less than Deployment replicas value, it may cause scale down + minReplicas: 5 + maxReplicas: 10 + behavior: + scaleDown: + # Indicates that the stability window considers the expected state of the past (here within 300 sec) to prevent expansion and contraction + stabilizationWindowSeconds: 300 + policies: + - type: Percent + value: 100 + periodSeconds: 15 + # The autoscaler will choose the strategy that affects the minimum number of Pods + selectPolicy: Min + scaleUp: + stabilizationWindowSeconds: 0 + policies: + - type: Percent + value: 100 + periodSeconds: 15 + - type: Pods + value: 4 + periodSeconds: 15 + selectPolicy: Max + metrics: +# Set the average usage rate of the cpu, scale up if it exceeds 50 + - type: Resource + resource: + name: cpu + target: + type: Utilization + averageUtilization: 50 +# The average data volume per second reaches 1000 for scaling up +# - type: Pods +# pods: +# metric: +# name: packets-per-second +# target: +# type: AverageValue +# averageValue: 1k + +# The value is derived from Ingress "main-route", scale up when the number of requests per second in Ingress reaches 2000 +# - type: Object +# object: +# metric: +# name: requests-per-second +# describedObject: +# apiVersion: networking.k8s.io/v1beta1 +# kind: Ingress +# name: main-route +# target: +# kind: Value +# value: 10k + +# HPA's current status data +status: + currentReplicas: 1 + desiredReplicas: 1 + conditions: + - status: "True" + type: "True" +# - type: Object +# object: +# metric: +# name: requests-per-second +# describedObject: +# apiVersion: networking.k8s.io/v1beta1 +# kind: Ingress +# name: main-route +# current: +# value: 10k diff --git a/kubernetes/services/subnet_manager.yaml b/kubernetes/services/subnet_manager.yaml index af64c4e23..679e7d37e 100644 --- a/kubernetes/services/subnet_manager.yaml +++ b/kubernetes/services/subnet_manager.yaml @@ -58,6 +58,12 @@ spec: #- image: fwnetworking/controller:subnet_manager-v0.3.0 name: subnetmanager-web imagePullPolicy: IfNotPresent + # The value is determined according to the actual situation, the following value is for the deployment on AWS + resources: + limits: + cpu: 500m + requests: + cpu: 200m command: ["java", "-jar", "/app/AlcorSubnetManager-0.1.0.jar", "--spring.config.location=/etc/subnet/application.properties"] ports: - containerPort: 8080 diff --git a/kubernetes/services/subnet_manager_hpa.yaml b/kubernetes/services/subnet_manager_hpa.yaml new file mode 100644 index 000000000..e142deef5 --- /dev/null +++ b/kubernetes/services/subnet_manager_hpa.yaml @@ -0,0 +1,79 @@ +apiVersion: autoscaling/v2beta2 +kind: HorizontalPodAutoscaler +metadata: + name: subnetmanager-hpa +spec: + scaleTargetRef: + apiVersion: apps/v1 + kind: Deployment + name: subnetmanager + # if minReplicas is less than Deployment replicas value, it may cause scale down + minReplicas: 5 + maxReplicas: 10 + behavior: + scaleDown: + # Indicates that the stability window considers the expected state of the past (here within 300 sec) to prevent expansion and contraction + stabilizationWindowSeconds: 300 + policies: + - type: Percent + value: 100 + periodSeconds: 15 + # The autoscaler will choose the strategy that affects the minimum number of Pods + selectPolicy: Min + scaleUp: + stabilizationWindowSeconds: 0 + policies: + - type: Percent + value: 100 + periodSeconds: 15 + - type: Pods + value: 4 + periodSeconds: 15 + selectPolicy: Max + metrics: + # Set the average usage rate of the cpu, scale up if it exceeds 50 + - type: Resource + resource: + name: cpu + target: + type: Utilization + averageUtilization: 50 +# The average data volume per second reaches 1000 for scaling up +# - type: Pods +# pods: +# metric: +# name: packets-per-second +# target: +# type: AverageValue +# averageValue: 1k + +# The value is derived from Ingress "main-route", scale up when the number of requests per second in Ingress reaches 2000 +# - type: Object +# object: +# metric: +# name: requests-per-second +# describedObject: +# apiVersion: networking.k8s.io/v1beta1 +# kind: Ingress +# name: main-route +# target: +# kind: Value +# value: 10k + +# HPA's current status data +status: + currentReplicas: 1 + desiredReplicas: 1 + conditions: + - status: "True" + type: "True" +# - type: Object +# object: +# metric: +# name: requests-per-second +# describedObject: +# apiVersion: networking.k8s.io/v1beta1 +# kind: Ingress +# name: main-route +# current: +# value: 10k diff --git a/kubernetes/services/vpc_manager.yaml b/kubernetes/services/vpc_manager.yaml index d8c2c9bae..b9f71ea42 100644 --- a/kubernetes/services/vpc_manager.yaml +++ b/kubernetes/services/vpc_manager.yaml @@ -56,6 +56,12 @@ spec: #- image: fwnetworking/controller:vpc_manager-v0.3.0 name: vpcmanager-web imagePullPolicy: IfNotPresent + # The value is determined according to the actual situation, the following value is for the deployment on AWS + resources: + limits: + cpu: 500m + requests: + cpu: 200m command: ["java", "-jar", "/app/AlcorVpcManager-0.1.0.jar", "--spring.config.location=/etc/app/application.properties"] ports: - containerPort: 8080 diff --git a/kubernetes/services/vpc_manager_hpa.yaml b/kubernetes/services/vpc_manager_hpa.yaml new file mode 100644 index 000000000..e7f69b864 --- /dev/null +++ b/kubernetes/services/vpc_manager_hpa.yaml @@ -0,0 +1,79 @@ +apiVersion: autoscaling/v2beta2 +kind: HorizontalPodAutoscaler +metadata: + name: vpcmanager-hpa +spec: + scaleTargetRef: + apiVersion: apps/v1 + kind: Deployment + name: vpcmanager + # if minReplicas is less than Deployment replicas value, it may cause scale down + minReplicas: 5 + maxReplicas: 10 + behavior: + scaleDown: + # Indicates that the stability window considers the expected state of the past (here within 300 sec) to prevent expansion and contraction + stabilizationWindowSeconds: 300 + policies: + - type: Percent + value: 100 + periodSeconds: 15 + # The autoscaler will choose the strategy that affects the minimum number of Pods + selectPolicy: Min + scaleUp: + stabilizationWindowSeconds: 0 + policies: + - type: Percent + value: 100 + periodSeconds: 15 + - type: Pods + value: 4 + periodSeconds: 15 + selectPolicy: Max + metrics: +# Set the average usage rate of the cpu, scale up if it exceeds 50 + - type: Resource + resource: + name: cpu + target: + type: Utilization + averageUtilization: 50 +# The average data volume per second reaches 1000 for scaling up +# - type: Pods +# pods: +# metric: +# name: packets-per-second +# target: +# type: AverageValue +# averageValue: 1k + +# The value is derived from Ingress "main-route", scale up when the number of requests per second in Ingress reaches 2000 +# - type: Object +# object: +# metric: +# name: requests-per-second +# describedObject: +# apiVersion: networking.k8s.io/v1beta1 +# kind: Ingress +# name: main-route +# target: +# kind: Value +# value: 10k + +# HPA's current status data +status: + currentReplicas: 1 + desiredReplicas: 1 + conditions: + - status: "True" + type: "True" +# - type: Object +# object: +# metric: +# name: requests-per-second +# describedObject: +# apiVersion: networking.k8s.io/v1beta1 +# kind: Ingress +# name: main-route +# current: +# value: 10k