Im Rahmen des DevOps Practices and Tools- Kurses haben wir eine Ăbersetzung eines nĂŒtzlichen Artikels fĂŒr Sie vorbereitet.
Wir laden Sie auch zu einem offenen Webinar zum Thema "Prometheus: Schnellstart" ein . WĂ€hrend des Webinars werden die Teilnehmer zusammen mit einem Experten die Prometheus-Architektur und ihre Funktionsweise mit Metriken ĂŒberprĂŒfen. wird herausfinden, wie Warnungen und Ereignisse im System generiert werden.
Warten Sie ... was, was? Ja, ich habe Àhnliche Reaktionen auf meinen Vorschlag gehört, Kubernetes zum Erstellen von Kubernetes-Clustern zu verwenden.
FĂŒr die Automatisierung der Cloud-Infrastruktur fĂ€llt mir jedoch nichts Besseres ein als Kubernetes . Mit einem zentralen K8s-Cluster erstellen und verwalten wir Hunderte anderer K8s-Cluster. In diesem Artikel zeige ich Ihnen, wie es geht.
: SAP Concur AWS EKS, , , Google GKE, Azure AKS , Kubernetes.
Kubernetes . AWS EKS :
$ eksctl create cluster
Kubernetes, (production ready), . « » , SAP Concur Kubernetes.
. AWS, . : IP- , AWS exports, SSM .
EKS control plane nodegroup. AWS EKS .
. , :-) Istio, logging integration, autoscaler .. .
. ( EKS ) . , . ( !)
, . , , , - , , .
Argo. , Argo Events Argo Workflows. Kubernetes CRD YAML, Kubernetes.
: (Imperative Orchestration), (Declarative Automation).
Argo Workflows
Argo Workflows â container-native workflow engine Kubernetes. Argo Workflows Kubernetes CRD.
: K8s YAML, , .
, Argo Workflows.
1.
BATS. BATS :
#!/usr/bin/env bats
@test âMore than 100 available IP addresses in subnet MySubnetâ {
AvailableIpAddressCount=$(aws ec2 describe-subnets --subnet-ids MySubnet | jq -r â.Subnets[0].AvailableIpAddressCountâ)
[ â${AvailableIpAddressCount}â -gt 100 ]
}
BATS- ( avail-ip-addresses.bats
) Argo Workflow :
â name: preflight-tests templateRef: name: argo-templates template: generic-template arguments: parameters: â name: command value: â{{item}}â withItems: â bats /tests/preflight/accnt-name-export.batsâ â bats /tests/preflight/avail-ip-addresses.batsâ â bats /tests/preflight/dhcp.batsâ â bats /tests/preflight/subnet-export.batsâ
2. EKS control plane nodegroup
EKS . eksctl
, CloudFormation Terraform. EKS , CloudFormation (eks-controlplane.yaml
eks-nodegroup.yaml
), Argo Workflow .
â name: eks-controlplane
dependencies: [âpreflight-testsâ]
templateRef:
name: argo-templates
template: generic-template
arguments:
parameters:
â name: command
value: |
aws cloudformation deploy \
--stack-name {{workflow.parameters.CLUSTER_NAME}} \
--template-file /eks-core/eks-controlplane.yaml \
--capabilities CAPABILITY_IAM
- name: eks-nodegroup
dependencies: [âeks-controlplaneâ]
templateRef:
name: argo-templates
template: generic-template
arguments:
parameters:
â name: command
value: |
aws cloudformation deploy \
--stack-name {{workflow.parameters.CLUSTER_NAME}}-nodegroup \
--template-file /eks-core/eks-nodegroup.yaml \
--capabilities CAPABILITY_IAM
3.
, kubectl
, helm, kustomize . , metrics-server
helm template
kubectl
, , metrics-server
, Argo Workflows .
â name: metrics-server
dependencies: [âeks-nodegroupâ]
templateRef:
name: argo-templates
template: generic-template
when: ââ{{workflow.parameters.METRICS-SERVER}}â != noneâ
arguments:
parameters:
â name: command
value: |
helm template /addons/{{workflow.parameters.METRICS-SERVER}}/ \
--name âmetrics-serverâ \
--namespace âkube-systemâ \
--set global.registry={{workflow.parameters.CONTAINER_HUB}} | \
kubectl apply -f -
4.
BATS- DETIK, K8s-.
#!/usr/bin/env bats
load âlib/utilsâ
load âlib/detikâ
DETIK_CLIENT_NAME=âkubectlâ
DETIK_CLIENT_NAMESPACE="kube-system"
@test âverify the deployment metrics-serverâ {
run verify âthere are 2 pods named âmetrics-serverââ
[ â$statusâ -eq 0 ]
run verify âthere is 1 service named âmetrics-serverââ
[ â$statusâ -eq 0 ]
run try âat most 5 times every 30s to find 2 pods named âmetrics-serverâ with âstatusâ being ârunningââ
[ â$statusâ -eq 0 ]
run try âat most 5 times every 30s to get pods named âmetrics-serverâ and verify that âstatusâ is ârunningââ
[ â$statusâ -eq 0 ]
}
BATS DETIK (metrics-server.bats
), , metrics-server
, Argo Workflows :
â name: test-metrics-server
dependencies: [âmetrics-serverâ]
templateRef:
name: worker-containers
template: addons-tests-template
when: ââ{{workflow.parameters.METRICS-SERVER}}â != noneâ
arguments:
parameters:
â name: command
value: |
bats /addons/test/metrics-server.bats
, . Sonobuoy conformance tests, Popeye â A Kubernetes Cluster Sanitizer Fairwindsâ Polaris. Argo Workflows!
, , AWS EKS , , , metrics-server
. !
, .
WorkflowTemplate
Argo Workflows (WorkflowTemplate), workflow. â . , , . «» workflow, ( ), . Argo Events.
Argo Events
Argo Events â Kubernetes (workflow automation framework), K8s, Argo Workflow, . , webhook, s3, , , gcp pubsub, sns, sqs ..
API (Argo Events) JSON. , (WorkflowTemplate) API. , Kubernetes, :
? API .
EKS-? eks-core (control-plane nodegroup) API.
EKS-? addons API.
- ? test API.
Argo
Argo Events, Argo Workflows , .
, :
-
-
â . Argo .
-
S3
(WorkflowTemplate)
Events Sensor
, , . Argo Events, Argo Workflows . .