ajthyng
ajthyng

Reputation: 1275

How can I stop flux from deploying to my default namespace?

I have a Kubernetes cluster setup with Flux. I have an infrastructure folder that has ingress/base and ingress/overlays/development in it. Hopefully this screenshot helps with the directory structure:

directory structure of kubernetes infrastrcture folder

Below are my ingress.yaml and kustomization.yaml files from base:

# ingress.yaml
apiVersion: extensions/v1beta1
kind: Ingress
metadata:
  name: my-ingress
  annotations:
    kubernetes.io/ingress.class: alb
    alb.ingress.kubernetes.io/scheme: internet-facing
    alb.ingress.kubernetes.io/target-type: ip
spec:
  rules:
    - http:
        paths:
          - path: /*
            backend:
              serviceName: user-service
              servicePort: 80

# kustomization.yaml
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
resources:
  - ingress.yaml

In development's folder I have just a kustomization file:

# kustomization.yaml
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
namespace: development
resources:
  - ../../base

When I commit this structure to my flux repository everything successfully reconciles. However, its setting up an ingress in the default and development namespaces. I want the base folder to be the common config applied to every namespace, I don't want it deployed on its own.

How can I tell Kustomize, or flux, to only use my base folders as inputs to the overlays instead of actually deploying the base folder?

Upvotes: 0

Views: 788

Answers (1)

messivanio
messivanio

Reputation: 2311

You should use spec.path in your Flux Kustomization component.

spec:
  path: "./infrastructure/overlays"

Upvotes: 0

Related Questions