来自 AWS Codecommit 的 FluxCD 同步应用程序无法正常工作

发布于 2025-01-11 04:40:52 字数 2460 浏览 6 评论 0原文

我创建了一个用于 Flux 同步应用程序的 AWS Codecommit 存储库,但同步失败。 我创建的部署.yaml 没有像我预期的那样在 EKS 中生成 pod。

但在通量日志中看起来很棒。

...
2022-03-02T08:20:56.336Z info GitRepository/flux-system.flux-system - Reconciliation finished in 3.605422284s, next run in 1m0s 
2022-03-02T08:22:00.082Z info GitRepository/flux-system.flux-system - Reconciliation finished in 3.745400563s, next run in 1m0s 
2022-03-02T08:23:03.845Z info GitRepository/flux-system.flux-system - Reconciliation finished in 3.762569909s, next run in 1m0s 
...

不知道如何检查错误。

depolyment.yaml 上下文如下:

apiVersion: apps/v1
kind: Deployment
metadata:
  name: my-hostname-app
  namespace: default
spec:
  replicas: 2
  selector:
    matchLabels:
      app: nginx
  template:
    metadata:
      labels:
        app: nginx
    spec:
      containers:
        - name: nginx
          image: nginx
          ports:
          - name: http
            containerPort: 80

codecommit 存储库中的文件树如下:

└── clusters
    └── my-cluster
        ├── demo
        │   └── nginx.yaml
        └── flux-system
            ├── gotk-components.yaml
            ├── gotk-sync.yaml
            └── kustomization.yaml

Flux 检查命令

► checking prerequisites
✔ Kubernetes 1.20.11-eks-f17b81 >=1.20.6-0
► checking controllers
✔ helm-controller: deployment ready
► ghcr.io/fluxcd/helm-controller:v0.17.1
✔ kustomize-controller: deployment ready
► ghcr.io/fluxcd/kustomize-controller:v0.21.1
✔ notification-controller: deployment ready
► ghcr.io/fluxcd/notification-controller:v0.22.2
✔ source-controller: deployment ready
► ghcr.io/fluxcd/source-controller:v0.21.2
✔ all checks passed

Flux pod 状态:

NAMESPACE   NAME                        READY   MESSAGE                         REVISION        SUSPENDED 
flux-system gitrepository/flux-system   True    Fetched revision: main/cc31370  main/cc31370    False       

NAMESPACE   NAME                        READY   MESSAGE                         REVISION        SUSPENDED 
flux-system kustomization/flux-system   True    Applied revision: main/cc31370  main/cc31370    False       

看起来一切都很好,但与在 EKS 中部署 pod 的预期不同。

环境

  1. Flux 版本 0.27.3
  2. k8s 版本 1.20.0
  3. eksctl 版本 0.84.0
  4. 操作系统。 Amazon-Linux

如果需要任何其他信息,我会立即添加,只是希望能够找到错误原因

I create a AWS codecommit repository that use for flux sync application but sync failed.
The deployment.yaml I create did not produce pods in EKS as I expected.

But in the flux log that looks great.

...
2022-03-02T08:20:56.336Z info GitRepository/flux-system.flux-system - Reconciliation finished in 3.605422284s, next run in 1m0s 
2022-03-02T08:22:00.082Z info GitRepository/flux-system.flux-system - Reconciliation finished in 3.745400563s, next run in 1m0s 
2022-03-02T08:23:03.845Z info GitRepository/flux-system.flux-system - Reconciliation finished in 3.762569909s, next run in 1m0s 
...

Not sure how to check for errors.

The depolyment.yaml context following:

apiVersion: apps/v1
kind: Deployment
metadata:
  name: my-hostname-app
  namespace: default
spec:
  replicas: 2
  selector:
    matchLabels:
      app: nginx
  template:
    metadata:
      labels:
        app: nginx
    spec:
      containers:
        - name: nginx
          image: nginx
          ports:
          - name: http
            containerPort: 80

The file tree in codecommit repository like:

└── clusters
    └── my-cluster
        ├── demo
        │   └── nginx.yaml
        └── flux-system
            ├── gotk-components.yaml
            ├── gotk-sync.yaml
            └── kustomization.yaml

Flux check command

► checking prerequisites
✔ Kubernetes 1.20.11-eks-f17b81 >=1.20.6-0
► checking controllers
✔ helm-controller: deployment ready
► ghcr.io/fluxcd/helm-controller:v0.17.1
✔ kustomize-controller: deployment ready
► ghcr.io/fluxcd/kustomize-controller:v0.21.1
✔ notification-controller: deployment ready
► ghcr.io/fluxcd/notification-controller:v0.22.2
✔ source-controller: deployment ready
► ghcr.io/fluxcd/source-controller:v0.21.2
✔ all checks passed

Flux pods status:

NAMESPACE   NAME                        READY   MESSAGE                         REVISION        SUSPENDED 
flux-system gitrepository/flux-system   True    Fetched revision: main/cc31370  main/cc31370    False       

NAMESPACE   NAME                        READY   MESSAGE                         REVISION        SUSPENDED 
flux-system kustomization/flux-system   True    Applied revision: main/cc31370  main/cc31370    False       

It's looks all good, But not as expected that deployed pods in EKS.

Environment

  1. flux version 0.27.3
  2. k8s version 1.20.0
  3. eksctl version 0.84.0
  4. OS. Amazon-Linux

If any other info is needed, I'll add it right away, just hope that the cause of the error can be found

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

孤独岁月 2025-01-18 04:40:52

看起来您的 nginx 部署不是集群协调的一部分。在本地使用 kustomize build cluster/my-cluster/flux-system 来查看部署是否在这里。

请参阅示例如何在该集群中包含额外的conf。

Looks like your nginx deployment is NOT part of cluster reconciliation. Use kustomize build cluster/my-cluster/flux-system locally to see if the deployment is here or not.

See example how include additional conf in that cluster.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文