Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Loading manifests without namespace specified fails #151

Closed
dpen2000 opened this Issue Mar 4, 2019 · 4 comments

Comments

Projects
None yet
4 participants
@dpen2000
Copy link
Contributor

dpen2000 commented Mar 4, 2019

Describe the bug
K3s fails to load manifests from /var/lib/rancher/k3s/server/manifests if they don't specify a namespace.

To Reproduce

  1. Run k3s server in one terminal
  2. Run nano /var/lib/rancher/k3s/server/manifests/deployment.yaml in another terminal
  3. Paste ( from https://kubernetes.io/docs/tasks/run-application/run-stateless-application-deployment/ ):
apiVersion: apps/v1 # for versions before 1.9.0 use apps/v1beta2
kind: Deployment
metadata:
  name: nginx-deployment
spec:
  selector:
    matchLabels:
      app: nginx
  replicas: 2 # tells deployment to run 2 pods matching the template
  template:
    metadata:
      labels:
        app: nginx
    spec:
      containers:
      - name: nginx
        image: nginx:1.7.9
        ports:
        - containerPort: 80
  1. Save
  2. k3s logs in first terminal show error:
ERRO[2019-03-04T23:49:11.027423617Z] failed to process config: failed to process /var/lib/rancher/k3s/server/manifests/deployment.yaml: failed to create nginx-deployment apps/v1, Kind=Deployment for deployment: an empty namespace may not be set during creation

Expected behavior
K3s should assume default namespace and create deployment as per kubectl apply

@dpen2000

This comment has been minimized.

Copy link
Contributor Author

dpen2000 commented Mar 5, 2019

@ibuildthecloud I've got k3s building myself now so happy to try to send a PR for this one.

@ibuildthecloud

This comment has been minimized.

Copy link
Member

ibuildthecloud commented Mar 7, 2019

@dpen2000 I went ahead and tried to fix this while I was fixing another bug, but it's not heavily tested. Do you want to give v0.2.0-rc6 a try and see if its working now? It should assign the namespace to "default" for namespaced resources where the namespace is "".

@dpen2000

This comment has been minimized.

Copy link
Contributor Author

dpen2000 commented Mar 7, 2019

@ibuildthecloud The example above works. As for helm charts, I tried:

apiVersion: k3s.cattle.io/v1
kind: HelmChart
metadata:
  name: redis
spec:
  chart: stable/redis

which doesn't work for me. I don't get any error output about it either. This doesn't either:

apiVersion: k3s.cattle.io/v1
kind: HelmChart
metadata:
  name: redis
  namespace: default
spec:
  chart: stable/redis

Only specifiying kube-system seems to work:

apiVersion: k3s.cattle.io/v1
kind: HelmChart
metadata:
  name: redis
  namespace: kube-system
spec:
  chart: stable/redis

Editing this chart to say default results in it creating job.batch/helm-delete-redis to delete redis from cluster.

@erikwilson

This comment has been minimized.

Copy link
Member

erikwilson commented Mar 8, 2019

Also verified that example nginx deployment works, created a new issue for Helm deployments.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.