Skip to content
This repository has been archived by the owner on Mar 28, 2020. It is now read-only.

Commit

Permalink
Merge pull request #1863 from hasbro17/haseeb/run-etcd-pods-as-non-root
Browse files Browse the repository at this point in the history
k8sutil: run etcd pods as non-root user
  • Loading branch information
hasbro17 committed Jan 17, 2018
2 parents 12e526e + 2899587 commit 13b4b52
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions pkg/util/k8sutil/k8sutil.go
Original file line number Diff line number Diff line change
Expand Up @@ -292,6 +292,9 @@ func newEtcdPod(m *etcdutil.Member, initialCluster []string, clusterName, state,
}})
}

runAsNonRoot := true
podUID := int64(9000)
fsGroup := podUID
pod := &v1.Pod{
ObjectMeta: metav1.ObjectMeta{
Name: m.Name,
Expand Down Expand Up @@ -319,6 +322,11 @@ func newEtcdPod(m *etcdutil.Member, initialCluster []string, clusterName, state,
Hostname: m.Name,
Subdomain: clusterName,
AutomountServiceAccountToken: func(b bool) *bool { return &b }(false),
SecurityContext: &v1.PodSecurityContext{
RunAsUser: &podUID,
RunAsNonRoot: &runAsNonRoot,
FSGroup: &fsGroup,
},
},
}
SetEtcdVersion(pod, cs.Version)
Expand Down

0 comments on commit 13b4b52

Please sign in to comment.