mirror of https://github.com/k3s-io/k3s
Merge pull request #39966 from liggitt/cert-users
Automatic merge from submit-queue (batch tested with PRs 40168, 40165, 39158, 39966, 40190) Include system:masters group in the bootstrap admin client certificate Sets up the bootstrap admin client certificate for new clusters to be in the system:masters group Removes the need for an explicit grant to the kubecfg user in e2e-bindings ```release-note The default client certificate generated by kube-up now contains the superuser `system:masters` group ```pull/6/head
commit
1430597f7e
|
@ -1,19 +0,0 @@
|
|||
# This is the main user for the e2e tests. This is ok to leave long term
|
||||
# since the first user in the test can reasonably be high power
|
||||
# its kubecfg in gce
|
||||
# TODO consider provisioning each test its namespace and giving it an
|
||||
# admin user. This still has to exist, but e2e wouldn't normally use it
|
||||
apiVersion: rbac.authorization.k8s.io/v1alpha1
|
||||
kind: ClusterRoleBinding
|
||||
metadata:
|
||||
name: e2e-user-cluster-admin
|
||||
labels:
|
||||
kubernetes.io/cluster-service: "true"
|
||||
roleRef:
|
||||
apiGroup: rbac.authorization.k8s.io
|
||||
kind: ClusterRole
|
||||
name: cluster-admin
|
||||
subjects:
|
||||
- apiVersion: rbac/v1alpha1
|
||||
kind: User
|
||||
name: kubecfg
|
|
@ -1008,7 +1008,12 @@ function generate-certs {
|
|||
mv "kubelet.pem" "pki/issued/kubelet.crt"
|
||||
rm -f "kubelet.csr"
|
||||
|
||||
./easyrsa build-client-full kubecfg nopass
|
||||
# Make a superuser client cert with subject "O=system:masters, CN=kubecfg"
|
||||
./easyrsa --dn-mode=org \
|
||||
--req-cn=kubecfg --req-org=system:masters \
|
||||
--req-c= --req-st= --req-city= --req-email= --req-ou= \
|
||||
build-client-full kubecfg nopass
|
||||
|
||||
cd ../kubelet
|
||||
./easyrsa init-pki
|
||||
./easyrsa --batch "--req-cn=kubelet@$(date +%s)" build-ca nopass
|
||||
|
|
|
@ -99,7 +99,11 @@ else
|
|||
cp -p pki/issued/kubernetes-master.crt "${cert_dir}/server.cert" > /dev/null 2>&1
|
||||
cp -p pki/private/kubernetes-master.key "${cert_dir}/server.key" > /dev/null 2>&1
|
||||
fi
|
||||
./easyrsa build-client-full kubecfg nopass > /dev/null 2>&1
|
||||
# Make a superuser client cert with subject "O=system:masters, CN=kubecfg"
|
||||
./easyrsa --dn-mode=org \
|
||||
--req-cn=kubecfg --req-org=system:masters \
|
||||
--req-c= --req-st= --req-city= --req-email= --req-ou= \
|
||||
build-client-full kubecfg nopass > /dev/null 2>&1
|
||||
cp -p pki/ca.crt "${cert_dir}/ca.crt"
|
||||
cp -p pki/issued/kubecfg.crt "${cert_dir}/kubecfg.crt"
|
||||
cp -p pki/private/kubecfg.key "${cert_dir}/kubecfg.key"
|
||||
|
|
Loading…
Reference in New Issue