Home > Net >  Kubernetes Failed to create object: Namespace is required for v1.Endpoints
Kubernetes Failed to create object: Namespace is required for v1.Endpoints

Time:07-20

I'm currently trying to setup heketi on kubernetes, i need to create an endpoint like so (i'm using Ansible):

- hosts: 'masters'
  remote_user: kube
  become: yes
  become_user: kube
  vars:
    ansible_python_interpreter: /usr/bin/python3
  tasks:
    - name: "Create gluster endpoints on kubernetes master"
      kubernetes.core.k8s:
        state: present
        definition:
          apiVersion: v1
          kind: Endpoints
          metadata:
            name: glusterfs-cluster
            labels:
              storage.k8s.io/name: glusterfs
              storage.k8s.io/part-of: mine
              storage.k8s.io/created-by: username
          subsets:
            - addresses:
                - ip: 10.0.0.4
                  hostname: gluster1
                - ip: 10.0.0.5
                  hostname: gluster2
                - ip: 10.0.0.6
                  hostname: gluster3
                - ip: 10.0.0.7
                  hostname: gluster4
              ports:
                - port: 1

When i run ansible playbook on this i am getting this error:

Failed to create object: Namespace is required for v1.Endpoints

I can't find any information as to what it's talking about, what is the namespace supposed to be?

CodePudding user response:

An Endpoints resource (like a Pod, Service, Deployment, etc) is a namespaced resource: it cannot be created globally; it must be created inside a specific namespace.

We can't answer the question, "what is the namespace supposed to be?", because generally this will be something like "the same namespace as the resources that will rely on this Endpoints resource".

  • Related