-
Notifications
You must be signed in to change notification settings - Fork 31
Documentation for encrypt vCenter username/password Credentials or using SAML token authentication #489
Comments
I'll expand on this and submit a PR to the official docs, in the meantime here are the basic steps required: SAML token authenticationAs of Kubernetes release 1.11, the vSphere Cloud Provider includes support for SAML token authentication using the vCenter SSO API. Generate a self signed certificate% openssl req -newkey rsa:2048 -x509 -days 365 -nodes -keyout k8s-vcp.key -out k8s-vcp.crt -subj "/C=US/ST=CA/L=SF/O=VMware/OU=CNA/CN=www.vmware.com"
Generating a 2048 bit RSA private key
...............................+++
...............................................................................+++
writing new private key to 'k8s-vcp.key'
----- Create a solution userUsing govc v0.18 or higher: % govc sso.user.create -A -R Administrator -C "$(cat k8s-vcp.crt)" k8s-vcp Or, using dir-cli: % /usr/lib/vmware-vmafd/bin/dir-cli service create --wstrustrole --ssoadminrole Administrator --cert k8s-vcp.crt --name k8s-vcp
Service [k8s-vcp] created successfully The example openssl command can be run anywhere, but if you use dir-cli to create the solution user, the public key will need to be local to the vCenter machine. The public key file can be removed from the vCenter machine after the user is created. The Administrator role used in the examples above can be replaced with any role name that contains the minimal privileges required. A users role can be changed using the update command, for example: % govc sso.user.update -R k8s-role-name k8s-vcp When a solution user is created, it will automatically be added to the % govc sso.user.id k8s-vcp
[email protected] groups=LicenseService.Administrators,ActAsUsers,Administrators,Everyone,SystemConfiguration.Administrators,SolutionUsers Cloud config optionsvSphere Cloud Provider will use SAML token authentication if the user config option is set a PEM encoded public key and password option to private key. % cat <<EOF
[VirtualCenter "$(govc env -x GOVC_URL_HOST)"]
user = "$(awk '{printf "%s\\n", $0}' k8s-vcp.crt)"
password = "$(awk '{printf "%s\\n", $0}' k8s-vcp.key)"
EOF Resulting in: [VirtualCenter "example-vcenter.eng.vmware.com"]
user = "-----BEGIN CERTIFICATE-----\nMIIDkTCCAnmgAwIBAgIJALVKv3+BwTORMA0GCSqGSIb3DQEBCwUAMF8xCzAJBgNV\nBAYTAlVTMQswCQYDVQQIDAJDQTELMAkGA1UEBwwC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QKBgQDR0GnXoMVwL/xSv4ozSBuo/kgkuAvB008H\nzIB42QlD+r6yluj8ipsvbeR8fq0miInplaNH8nsNNZyLSfN0SX9qMckdVgLJthQu\nQV0s7tqiroVTZJ4vmiW7VcP3zUTItUWmrDPoZ7eMjINHdD4L3M2iJNJ+xNB3mPDP\nbL8wHli+qwKBgBuBFkMFQD0/qlcHcySSRN+r2UK/JE00IAg/AuDgCIfC8j9VByHm\nPew/A0aqdlVzsFw/Fi3MM19XSYxzkxrphe+KhgNzOUMcfzGrGE3ChoqF0rgzIAMW\n8IE42MvMq9wo4/7JgelpQjna+5C4WLfgHgEm9baNtl87iVq6FHhe0GLBAoGALrMf\ny9HKAFV96QEfBpkHJw8qCZo5a7PXxFmdQsi0CkB2T5PNWeCT9/OSxq7/ZTNA1w/q\nXuo2v1LufAZCvOBbDsz0AaaSSklPppf/4C9t1IXZwR0FJH0/5rmJO8+hfrbyQM3V\nY+Yp8YuY8L+Ly+IilvNxMqwl5mjROKnwyAoJIK8CgYBUUtjoTYneBeOSIiHYaHgB\noPSMATyVvx1wSnPQU0Z7CXLWfLcdWd48+YxxY+CLT+O7LeD1HJBuL+clUkk3LLSU\nq7Gwz7JttCax67VJ+Rvca/Ye99Z08San+oyleOc4vaWn+m3elfLYY35I6q2mjEGH\nK6YwNTQeE+GxGIJJncNJXQ==\n-----END PRIVATE KEY-----\n" |
@dougm Thank you very much for details. So if i understand right, i must go ahead and create a solution user then do the openssl to create certs, which can be used for all datacenters with in a vcenter. Also is there any special privileges required for a solution user as mentioned in below document https://vmware.github.io/vsphere-storage-for-kubernetes/documentation/vcp-roles.html#minimal-set-of-vsphere-rolesprivileges-required-for-dynamic-persistent-volume-provisioning-with-storage-policy-based-volume-placement |
@s0komma added a section on roles. |
Thank you very much |
Where do I place the certs for vSphere Cloud Provider? is it in the
Is there an option to use a Kubernetes Secret for the vSphere username/password? |
@jd485057 the steps to use secrets are listed here |
Is this a BUG REPORT or FEATURE REQUEST?:
What happened: would like to understand if vSphere Cloud Provider: add SAML token authentication support is something that can be used now. Previous issue is below #481
would like to see whats the best way to encrypt vCenter username/password Credentials in cloud-config file. if so would like to pointed to appropriate documentation, would also like to know whats the proposed k8s version to be used with this
What you expected to happen:
How to reproduce it (as minimally and precisely as possible):
Anything else we need to know?:
Environment:
kubectl version
):uname -a
):The text was updated successfully, but these errors were encountered: