FluxCD sync application from AWS Codecommit not work

3/2/2022

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

-- Chacha
amazon-eks
aws-codecommit
flux
kubernetes

1 Answer

3/2/2022

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.

-- Kane
Source: StackOverflow