Search code examples
kubernetesamazon-eks

Why did flux failed decoding Kubernetes YAML? missing Resource metadata


I am following Building a GITOPS pipeline with EKS.

After flux create source and flux create kustomization

my fleet-intra repo

tree -L 3
.
└── adorable-mushroom-1655535375
    ├── flux-system
    │   ├── gotk-components.yaml
    │   ├── gotk-sync.yaml
    │   └── kustomization.yaml
    └── guestbook-gitops.yaml

I have problem with kustomization

flux get kustomizations

NAME        REVISION                                        SUSPENDED   READY   MESSAGE                                                                                                                                          
flux-system main/75d8189db82f1c2c77d22a9deb6baea06f179d0c   False       False   failed to decode Kubernetes YAML from /tmp/kustomization-985813897/adorable-mushroom-1655535375/guestbook-gitops.yaml: missing Resource metadata    

My guestbook-gitops.yaml looks like this

apiVersion: kustomize.toolkit.fluxcd.io/v1beta2
kind: Kustomization
metadata:
  name: guestbook-gitops
  namespace: flux-system
spec:
  interval: 1h0m0s
  path: ./deploy
  prune: true
  sourceRef:
    kind: GitRepository
    name: guestbook-gitops

What is wrong with metadata?


Solution

  • In the link you had shared there sample kustomization yaml. you can prepare kustomize yaml in similar manner and check it.