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

Added RBAC policies for deployment #12

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

eugene-chow
Copy link

No description provided.

@eugene-chow
Copy link
Author

eugene-chow commented Apr 24, 2017

@kayrus Thanks for making EFK work on k8s :)

subjects:
- kind: ServiceAccount
name: es-client
namespace: logging
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Namespace logging or monitoring?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sorry. forgot to remove the namespace directive

@@ -47,4 +47,7 @@ eval "${KUBECTL} create configmap es-config --from-file=es-config --dry-run -o y
eval "${KUBECTL} create configmap fluentd-config --from-file=docker/fluentd/td-agent.conf --dry-run -o yaml" | eval "${KUBECTL} apply -f -"
eval "${KUBECTL} create configmap kibana-config --from-file=kibana.yml --dry-run -o yaml" | eval "${KUBECTL} apply -f -"

## Install RBAC policies
eval "${KUBECTL} apply -f rbac"

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you add the same for es5/deploy.sh?

I.e. create a ../rbac symlink and add eval "${KUBECTL} apply -f rbac"

I have plans to merge es5 and es2.x, but it still requires more testing.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done. I also took the liberty to update the undeploy.sh scripts and add the serviceAccount directive to the manifests which I missed out earlier.

Btw, the RBAC manifests were meant for ES2. ES5 is missing the k8s-events-printer.yaml and es-fluentd-ds.yaml manifests present in ES2. Is the ES5 deployment ready for use? I tried it a few weeks back but it didn't run properly.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ES5 is ready to be used, but there is no proper webui yet.
I use it with kibana5 and x-pack so far.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok. i'll test it again soon. for now, the rbac rules may not work properly with ES5

@kayrus
Copy link
Owner

kayrus commented Apr 24, 2017

@eugene-chow didn't you miss a role for es-master?

@eugene-chow
Copy link
Author

I built the RBAC rules based on the error messages. es-master didn't malfunction in my deployment so I thought it didn't need to talk to kube-apiserver. Can you advise?

@kayrus
Copy link
Owner

kayrus commented Apr 24, 2017

@eugene-chow how many masters do you have?

@eugene-chow
Copy link
Author

3 masters

@kayrus
Copy link
Owner

kayrus commented Apr 24, 2017

They definitely have to communicate to api-server. How do they do this without rbac? Or did I miss something?
Sorry, I don't have a test cluster with RBAC right now.

@eugene-chow
Copy link
Author

eugene-chow commented Apr 24, 2017 via email

@eugene-chow
Copy link
Author

es-master is not producing any errors. But if you say that it needs to talk to kube-apiserver, I believe its RBAC should be the same as those for es-data and es-client. Do you have an idea of which API endpoints it reads?

@eugene-chow
Copy link
Author

@kayrus what's your advice?

@kayrus
Copy link
Owner

kayrus commented Apr 27, 2017

Not really. I have to test this feature myself and if it's ok - I'll merge it.

@kayrus
Copy link
Owner

kayrus commented Jun 16, 2017

Sorry for the delay. I have a question, why did you remove namespaces from the manifests? eugene-chow@1d4d8e0

kubectl complains on namespace:

The ClusterRoleBinding "kubernetes-events-printer" is invalid: subjects[0].namespace: Required value

You have to define them for ClusterRoleBinding, but skip for RoleBinding

@eugene-chow
Copy link
Author

Namespace assignment is in the deploy.sh script so there's no need to specify it in the manifest.

A ClusterRoleBinding applies a Role/ClusterRole to the whole cluster. Specifying the namespace has no effect. I'm not certain why kubernetes-events-printer complains about the namespace. Never had that before.

@kayrus
Copy link
Owner

kayrus commented Jun 19, 2017

@eugene-chow which kubernetes version do you use? I tested on 1.6.4.

@eugene-chow
Copy link
Author

eugene-chow commented Jun 19, 2017 via email

@kayrus
Copy link
Owner

kayrus commented Jun 19, 2017

@eugene-chow I assume ClusterRoleBinding requires the namespace definition even when you use --namespace %namespace% parameter for kubedns, since you have to specify which service account and from which namespace should be used.

@eugene-chow
Copy link
Author

eugene-chow commented Jun 19, 2017 via email

@kayrus kayrus mentioned this pull request Sep 11, 2017
@kayrus
Copy link
Owner

kayrus commented Sep 11, 2017

It's also worth to introduce podsecuritypolicy for this. I have some kind of draft, maybe you can introduce it in this PR:

apiVersion: extensions/v1beta1
kind: PodSecurityPolicy
metadata:
  name: permissive-elk
spec:
  # Four below are for elasticsearch and ingress
  privileged: true
  # this is only for ingress
  hostNetwork: true
  allowedCapabilities:
  - IPC_LOCK
# this is not necessary for newer k8s versions and pod-anti-affinity
  hostPorts:
  - max: 28652
    min: 28652
  seLinux:
    rule: RunAsAny
  supplementalGroups:
    rule: RunAsAny
  runAsUser:
    rule: RunAsAny
  fsGroup:
    rule: RunAsAny
  volumes:
  - '*'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants