Understanding Service Accounts and SCCs - Red Hat OpenShift Blog
Understanding Service Accounts and SCCs - Red Hat OpenShift Blog
blog.openshift.com
We launched OpenShift 3.0 back in June 2015 and I have had the
pleasure of speaking with users all over Europe and the EMEA
region to help them get up and running with deploying applications
on the platform.
One of the features that developers and administrator often ask
questions about are Service Accounts and Security Context
Constraints. In this blog post, I will provide a simple introduction
into both concepts, how they work and their usage.
1 of 7 10/02/2020 15:56
Understanding Service Accounts and SCCs – Red Hat OpenShift Blog about:reader?url=https://blog.openshift.com/understanding-service-ac...
$ oc get scc
NAME PRIV CAPS HOSTDIR SELINUX
RUNASUSER FSGROUP SUPGROUP PRIORITY
anyuid false [] false MustRunAs
RunAsAny RunAsAny RunAsAny 10
hostaccess false [] true MustRunAs
MustRunAsRange RunAsAny RunAsAny <none>
hostmount-anyuid false [] true MustRunAs
RunAsAny RunAsAny RunAsAny <none>
nonroot false [] false MustRunAs
MustRunAsNonRoot RunAsAny RunAsAny <none>
privileged true [] true RunAsAny
RunAsAny RunAsAny RunAsAny <none>
restricted false [] false MustRunAs
MustRunAsRange RunAsAny RunAsAny <none>
2 of 7 10/02/2020 15:56
Understanding Service Accounts and SCCs – Red Hat OpenShift Blog about:reader?url=https://blog.openshift.com/understanding-service-ac...
configMap,downwardAPI,emptyDir,persistentVolumeClaim,secret
Allow Host Network: false
Allow Host Ports: false
Allow Host PID: false
Allow Host IPC: false
Read Only Root Filesystem: false
Run As User Strategy: MustRunAsRange
UID: <none>
UID Range Min: <none>
UID Range Max: <none>
SELinux Context Strategy: MustRunAs
User: <none>
Role: <none>
Type: <none>
Level: <none>
FSGroup Strategy: MustRunAs
Ranges: <none>
Supplemental Groups Strategy: RunAsAny
Ranges: <none>
Service Accounts
When a person uses the command line or web console, their API
token authenticates them to the OpenShift API. However, when a
regular user’s credentials are not available, it is common for
components to make API calls independently. For example:
3 of 7 10/02/2020 15:56
Understanding Service Accounts and SCCs – Red Hat OpenShift Blog about:reader?url=https://blog.openshift.com/understanding-service-ac...
As you can see, there are many use cases for Service Accounts,
and if we dive into the first use case aforementioned, we need to
understand that OpenShift (and Kubernetes) are not synchronous
in the execution of their commands.
What this really means is, the actions are executed by the
OpenShift controllers and not by the actual user, that expressed the
desired state. This leads to the situation where we need to identify
who’s executing the actions the controllers are invoking.
4 of 7 10/02/2020 15:56
Understanding Service Accounts and SCCs – Red Hat OpenShift Blog about:reader?url=https://blog.openshift.com/understanding-service-ac...
{
"kind": "DeploymentConfig",
"apiVersion": "v1",
"metadata": {...},
"spec": {
...
"template": {
...
"spec":{
"containers": [
],
...
"serviceAccountName":
"myserviceaccount"
}
}
}
}
5 of 7 10/02/2020 15:56
Understanding Service Accounts and SCCs – Red Hat OpenShift Blog about:reader?url=https://blog.openshift.com/understanding-service-ac...
6 of 7 10/02/2020 15:56
Understanding Service Accounts and SCCs – Red Hat OpenShift Blog about:reader?url=https://blog.openshift.com/understanding-service-ac...
7 of 7 10/02/2020 15:56