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 instructions for daemonsets on OpenShift #346

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 27 additions & 0 deletions README.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,33 @@ oc create \

After the role is granted, switch back to a non-privileged user.

Jaeger Agent can be configured to be deployed as a `DaemonSet` using a `HostPort` to allow Jaeger clients in the same node to discover the agent. In OpenShift, a `HostPort` can only be set when a special security context is set. A separate service account can be used by the Jaeger Agent with the permission to bind to `HostPort`, as follows:

[source,bash]
----
oc create -f https://raw.githubusercontent.com/jaegertracing/jaeger-operator/master/deploy/examples/openshift/hostport-scc-daemonset.yaml # <1>

oc new-project myappnamespace
oc create -f https://raw.githubusercontent.com/jaegertracing/jaeger-operator/master/deploy/examples/openshift/service_account_jaeger-agent-daemonset.yaml # <2>
oc adm policy add-scc-to-user daemonset-with-hostport -z jaeger-agent-daemonset # <3>
oc apply -f https://raw.githubusercontent.com/jaegertracing/jaeger-operator/master/deploy/examples/openshift/agent-as-daemonset.yaml # <4>
----
<1> The `SecurityContextConstraints` with the `allowHostPorts` policy
<2> The `ServiceAccount` to be used by the Jaeger Agent
<3> Adds the security policy to the service account
<4> Creates the Jaeger Instance using the `serviceAccount` created in the steps above

WARNING: without such a policy, errors like the following will prevent a `DaemonSet` to be created: `Warning FailedCreate 4s (x14 over 45s) daemonset-controller Error creating: pods "agent-as-daemonset-agent-daemonset-" is forbidden: unable to validate against any security context constraint: [spec.containers[0].securityContext.containers[0].hostPort: Invalid value: 5775: Host ports are not allowed to be used`

After a few seconds, the `DaemonSet` should be up and running:

[source,console]
----
$ oc get daemonset agent-as-daemonset-agent-daemonset
NAME DESIRED CURRENT READY UP-TO-DATE AVAILABLE
agent-as-daemonset-agent-daemonset 1 1 1 1 1
----

== Creating a new Jaeger instance

Example custom resources, for different configurations of Jaeger, can be found https://github.com/jaegertracing/jaeger-operator/tree/master/deploy/examples[here].
Expand Down
10 changes: 10 additions & 0 deletions deploy/examples/openshift/agent-as-daemonset.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
apiVersion: jaegertracing.io/v1
kind: Jaeger
metadata:
name: agent-as-daemonset
spec:
agent:
strategy: DaemonSet
serviceAccount: jaeger-agent-daemonset
options:
log-level: debug
11 changes: 11 additions & 0 deletions deploy/examples/openshift/hostport-scc-daemonset.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
kind: SecurityContextConstraints
apiVersion: security.openshift.io/v1
metadata:
name: daemonset-with-hostport
annotations:
kubernetes.io/description: 'Allows DaemonSets to bind to a well-known host port'
runAsUser:
type: RunAsAny
seLinuxContext:
type: RunAsAny
allowHostPorts: true
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
apiVersion: v1
kind: ServiceAccount
metadata:
name: jaeger-agent-daemonset