2

Here is the folder structure for my flux repo

└── clusters
  └── homelab
    ├── default
    │   ├── deployment.yaml
    └── flux-system
        ├── gotk-components.yaml
        ├── gotk-sync.yaml
        └── kustomization.yaml

And when I pushed the deployment.yaml file and checked the deployment using flux get kustomizations --watch

I got the following error;

NAME        REVISION            SUSPENDED   READY   MESSAGE                                                                                                                                                                                                                                                                                                                                  
flux-system main@sha1:58009946  False       False   kustomize build failed: accumulating resources: accumulation err='merging resources from './default/deployment.yaml': may not add resource with an already registered id: Deployment.v1.apps/spring-web.[noNs]': must build at directory: '/tmp/kustomization-308548873/clusters/homelab/default/deployment.yaml': file is not directory

I've tried deleting the kustomization using flux delete kustomization flux-system but it didn't go anything at it still remains in the output.

Also can't see any deployment in k8s under that name when checking kubectl get deployments -A

blackgreen
  • 34,072
  • 23
  • 111
  • 129
Kaigo
  • 1,267
  • 2
  • 14
  • 33

2 Answers2

0

You need to have a kustomization.yaml file in the default directory.

└── clusters
  └── homelab
    ├── default
    │   ├── deployment.yaml
    │   ├── kustomization.yaml
    └── flux-system
        ├── gotk-components.yaml
        ├── gotk-sync.yaml
        └── kustomization.yaml

Inside the kustomization.yaml, we should include the deployment.yaml file, as shown below:

apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
resources:
  - deployment.yaml
Farhaan
  • 1
  • 1
0

I once got this error because I tried creating two resources with the same name in the same namespace.

Guy
  • 1,254
  • 17
  • 16