upmc-enterprises/elasticsearch-operator

operator is running, but can not create client,master,data

gaozhiqiangk opened this issue · 1 comments

$ kubectl apply -f elasticsearch-cluster.yaml

$ kubectl get pods -n logging
NAME READY STATUS RESTARTS AGE
elasticsearch-operator-6db688bc67-f67vs 1/1 Running 0 53s
fluent-bit-2kb5s 1/1 Running 1 17h
fluent-bit-7zc6m 1/1 Running 1 17h
fluent-bit-n4wmr 1/1 Running 2 17h
fluent-bit-xxs69 1/1 Running 1 5h13m

$ kubectl explain elasticsearchclusters
error: Couldn't find resource for "enterprises.upmc.com/v1, Kind=ElasticsearchCluster"

$ kubectl apply -f elasticsearch-cluster.yaml
$ kubectl get pods -n logging
NAME READY STATUS RESTARTS AGE
elasticsearch-operator-6db688bc67-f67vs 1/1 Running 0 53s
fluent-bit-2kb5s 1/1 Running 1 17h
fluent-bit-7zc6m 1/1 Running 1 17h
fluent-bit-n4wmr 1/1 Running 2 17h
fluent-bit-xxs69 1/1 Running 1 5h13m

$ vim elasticsearch-operator.yaml
apiVersion: v1
kind: ServiceAccount
metadata:
name: elasticsearch-operator
namespace: logging

apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
name: elasticsearch-operator
rules:

  • apiGroups: ["extensions"]
    resources: ["deployments", "replicasets", "daemonsets"]
    verbs: ["create", "get", "update", "delete", "list"]
  • apiGroups: ["apiextensions.k8s.io"]
    resources: ["customresourcedefinitions"]
    verbs: ["create", "get", "update", "delete", "list"]
  • apiGroups: ["storage.k8s.io"]
    resources: ["storageclasses"]
    verbs: ["get", "list", "create", "delete", "deletecollection"]
  • apiGroups: [""]
    resources: ["persistentvolumes", "persistentvolumeclaims", "services", "secrets", "configmaps"]
    verbs: ["create", "get", "update", "delete", "list"]
  • apiGroups: ["batch"]
    resources: ["cronjobs", "jobs"]
    verbs: ["create", "get", "deletecollection", "delete"]
  • apiGroups: [""]
    resources: ["pods"]
    verbs: ["list", "get", "watch"]
  • apiGroups: ["apps"]
    resources: ["statefulsets", "deployments"]
    verbs: ["*"]
  • apiGroups: ["enterprises.upmc.com"]
    resources: ["elasticsearchclusters"]
    verbs: ["*"]

apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
name: elasticsearch-operator
namespace: logging
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
name: elasticsearch-operator
subjects:

  • kind: ServiceAccount
    name: elasticsearch-operator
    namespace: logging

apiVersion: apps/v1
kind: Deployment
metadata:
name: elasticsearch-operator
namespace: logging
spec:
replicas: 1
selector:
matchLabels:
app: elasticsearch-operator
template:
metadata:
name: elasticsearch-operator
namespace: logging
labels:
app: elasticsearch-operator
spec:
containers:
- name: elasticsearch-operator
image: upmcenterprises/elasticsearch-operator:0.2.0
imagePullPolicy: IfNotPresent
env:
- name: NAMESPACE
valueFrom:
fieldRef:
fieldPath: metadata.namespace
ports:
- name: http
containerPort: 8000
livenessProbe:
httpGet:
path: /live
port: 8000
initialDelaySeconds: 10
timeoutSeconds: 10
readinessProbe:
httpGet:
path: /ready
port: 8000
initialDelaySeconds: 10
timeoutSeconds: 5
resources:
requests:
memory: 128Mi
cpu: 100m
limits:
memory: 128Mi
cpu: 100m
serviceAccountName: elasticsearch-operator

It looks like the CRD wasn't created properly. Can you restart the operator and see if it recreates? If not there may be an RBAC permissions issue where it cannot create crd's in your cluster.