Skip to content

Added RBAC policies for deployment#12

Open
eugene-chow wants to merge 3 commits into
kayrus:masterfrom
eugene-chow:master
Open

Added RBAC policies for deployment#12
eugene-chow wants to merge 3 commits into
kayrus:masterfrom
eugene-chow:master

Conversation

@eugene-chow

Copy link
Copy Markdown

No description provided.

@eugene-chow

eugene-chow commented Apr 24, 2017

Copy link
Copy Markdown
Author

@kayrus Thanks for making EFK work on k8s :)

Comment thread rbac/es-client-rb.yaml Outdated
subjects:
- kind: ServiceAccount
name: es-client
namespace: logging

Copy link
Copy Markdown
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
Copy Markdown
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

Comment thread deploy.sh

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

Copy link
Copy Markdown
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.

@eugene-chow eugene-chow Apr 24, 2017

Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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

kayrus commented Apr 24, 2017

Copy link
Copy Markdown
Owner

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

@eugene-chow

Copy link
Copy Markdown
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

kayrus commented Apr 24, 2017

Copy link
Copy Markdown
Owner

@eugene-chow how many masters do you have?

@eugene-chow

Copy link
Copy Markdown
Author

3 masters

@kayrus

kayrus commented Apr 24, 2017

Copy link
Copy Markdown
Owner

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

eugene-chow commented Apr 24, 2017 via email

Copy link
Copy Markdown
Author

@eugene-chow

Copy link
Copy Markdown
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
Copy Markdown
Author

@kayrus what's your advice?

@kayrus

kayrus commented Apr 27, 2017

Copy link
Copy Markdown
Owner

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

@kayrus

kayrus commented Jun 16, 2017

Copy link
Copy Markdown
Owner

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
Copy Markdown
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

kayrus commented Jun 19, 2017

Copy link
Copy Markdown
Owner

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

@eugene-chow

eugene-chow commented Jun 19, 2017 via email

Copy link
Copy Markdown
Author

@kayrus

kayrus commented Jun 19, 2017

Copy link
Copy Markdown
Owner

@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

eugene-chow commented Jun 19, 2017 via email

Copy link
Copy Markdown
Author

@kayrus kayrus mentioned this pull request Sep 11, 2017
@kayrus

kayrus commented Sep 11, 2017

Copy link
Copy Markdown
Owner

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.

2 participants