本文档适用于希望在单个集群上设置 GKE Identity Service 的集群管理员或应用运维人员,以使开发者和其他用户可以使用来自安全断言标记语言 (SAML) 提供方的现有身份详细信息登录集群。本指南假定您已阅读 GKE Identity Service 概览。本文档中的说明假定 GKE Identity Service 已作为客户端应用向您的身份提供商注册。
apiVersion:authentication.gke.io/v2alpha1kind:ClientConfigmetadata:name:defaultnamespace:kube-publicspec:authentication:-name:NAMEsaml:idpEntityID:ENTITY_IDidpSingleSignOnURI:SIGN_ON_URIidpCertificateDataList:IDP_CA_CERTuserAttribute:USER_ATTRIBUTEgroupsAttribute:{'<var name="user attribute">GROUPS_ATTRIBUTE</var>'}}userPrefix:USER_PREFIXgroupPrefix:GROUP_PREFIXattributeMapping:ATTRIBUTE_KEY_1 :ATTRIBUTE_CEL_EXPRESSION_1ATTRIBUTE_KEY_2 :ATTRIBUTE_CEL_EXPRESSION_2certificateAuthorityData:CERTIFICATE_STRINGpreferredAuthentication:PREFERRED_AUTHENTICATIONserver:<>
# Rest of the resource is managed by Google. DO NOT MODIFY....
下表介绍了 ClientConfig saml 对象的字段。您需要添加的字段取决于您的身份提供方,以及您的平台管理员在为 GKE Identity Service 配置提供方时选择的设置选项。
[[["易于理解","easyToUnderstand","thumb-up"],["解决了我的问题","solvedMyProblem","thumb-up"],["其他","otherUp","thumb-up"]],[["很难理解","hardToUnderstand","thumb-down"],["信息或示例代码不正确","incorrectInformationOrSampleCode","thumb-down"],["没有我需要的信息/示例","missingTheInformationSamplesINeed","thumb-down"],["翻译问题","translationIssue","thumb-down"],["其他","otherDown","thumb-down"]],["最后更新时间 (UTC):2024-12-18。"],[],[],null,["# Set up clusters for GKE Identity Service with SAML\n==================================================\n\nThis document is for **cluster administrators** or application operators who want to set up GKE Identity Service on individual clusters, allowing developers and other users to log in to the clusters using their existing identity details from a [Security Assertion Markup Language (SAML)](https://docs.oasis-open.org/security/saml/Post2.0/sstc-saml-tech-overview-2.0.html) provider. The guide assumes that you have read the GKE Identity Service [overview](/kubernetes-engine/enterprise/identity).\nThe instructions in this document assume that GKE Identity Service has already been [registered with your identity provider](/kubernetes-engine/enterprise/identity/setup/saml-provider) as a client application.\n\nBefore you begin\n----------------\n\n- Ensure that your platform administrator has given you all the necessary information from [Register GKE Identity Service with your provider](/kubernetes-engine/enterprise/identity/setup/saml-provider) before you start setup.\n- Ensure that you have the following command line tools installed:\n\n - Use the 466.0.0 version of the Google Cloud CLI or higher, which includes `gcloud`, the command line tool for interacting with Google Cloud. If you need to install the Google Cloud CLI, see the [installation guide](/sdk/docs/install).\n - `kubectl` for running commands against Kubernetes clusters. If you need to install `kubectl`, follow these [instructions](/kubernetes-engine/fleet-management/docs/before-you-begin#install-kubectl).\n\n If you are using Cloud Shell as your shell environment for interacting with Google Cloud, these tools are installed for you.\n- Ensure that you have [initialized](/sdk/docs/install-sdk#initializing_the) the gcloud CLI for use with the project where the clusters are registered.\n\nConfigure the cluster\n---------------------\n\nGKE Identity Service uses a special Kubernetes custom resource type (CRD)\nto configure your clusters called ClientConfig, with fields for information about\nthe identity provider and the parameters it needs to return user information. \n\n### kubectl\n\nTo edit your default ClientConfig, make sure you can connect to your cluster\nusing `kubectl`, and run the following command: \n\n kubectl --kubeconfig=\u003cvar translate=\"no\"\u003eKUBECONFIG_PATH\u003c/var\u003e edit ClientConfigs default -n kube-public\n\nReplace \u003cvar translate=\"no\"\u003eKUBECONFIG_PATH\u003c/var\u003e with the path to your\ncluster's kubeconfig file---for example `$HOME/.kube/config`.\n\nA text editor loads your cluster's ClientConfig resource. Add the `saml`\nobject as indicated in the snippet. \n\n apiVersion: authentication.gke.io/v2alpha1\n kind: ClientConfig\n metadata:\n name: default\n namespace: kube-public\n spec:\n authentication:\n - name: \u003cvar name=\"name\" translate=\"no\"\u003e\u003cspan class=\"devsite-syntax-l devsite-syntax-l-Scalar devsite-syntax-l-Scalar-Plain\"\u003eNAME\u003c/span\u003e\u003c/var\u003e\n saml:\n idpEntityID: \u003cvar name=\"entity id\" translate=\"no\"\u003e\u003cspan class=\"devsite-syntax-l devsite-syntax-l-Scalar devsite-syntax-l-Scalar-Plain\"\u003eENTITY_ID\u003c/span\u003e\u003c/var\u003e\n idpSingleSignOnURI: \u003cvar name=\"sign on uri\" translate=\"no\"\u003e\u003cspan class=\"devsite-syntax-l devsite-syntax-l-Scalar devsite-syntax-l-Scalar-Plain\"\u003eSIGN_ON_URI\u003c/span\u003e\u003c/var\u003e\n idpCertificateDataList: \u003cvar name=\"idp ca cert\" translate=\"no\"\u003e\u003cspan class=\"devsite-syntax-l devsite-syntax-l-Scalar devsite-syntax-l-Scalar-Plain\"\u003eIDP_CA_CERT\u003c/span\u003e\u003c/var\u003e\n userAttribute: \u003cvar name=\"user attribute\" translate=\"no\"\u003e\u003cspan class=\"devsite-syntax-l devsite-syntax-l-Scalar devsite-syntax-l-Scalar-Plain\"\u003eUSER_ATTRIBUTE\u003c/span\u003e\u003c/var\u003e\n groupsAttribute: {'\u003cvar name=\"user attribute\"\u003eGROUPS_ATTRIBUTE\u003c/var\u003e'}}\n userPrefix: \u003cvar name=\"user prefix\" translate=\"no\"\u003e\u003cspan class=\"devsite-syntax-l devsite-syntax-l-Scalar devsite-syntax-l-Scalar-Plain\"\u003eUSER_PREFIX\u003c/span\u003e\u003c/var\u003e\n groupPrefix: \u003cvar name=\"group prefix\" translate=\"no\"\u003e\u003cspan class=\"devsite-syntax-l devsite-syntax-l-Scalar devsite-syntax-l-Scalar-Plain\"\u003eGROUP_PREFIX\u003c/span\u003e\u003c/var\u003e\n attributeMapping:\n ATTRIBUTE_KEY_1 : \u003cvar name=\"attribute cel expression 1\" translate=\"no\"\u003e\u003cspan class=\"devsite-syntax-l devsite-syntax-l-Scalar devsite-syntax-l-Scalar-Plain\"\u003eATTRIBUTE_CEL_EXPRESSION_1\u003c/span\u003e\u003c/var\u003e\n ATTRIBUTE_KEY_2 : \u003cvar name=\"attribute cel expression 2\" translate=\"no\"\u003e\u003cspan class=\"devsite-syntax-l devsite-syntax-l-Scalar devsite-syntax-l-Scalar-Plain\"\u003eATTRIBUTE_CEL_EXPRESSION_2\u003c/span\u003e\u003c/var\u003e\n certificateAuthorityData: \u003cvar name=\"cert string\" translate=\"no\"\u003e\u003cspan class=\"devsite-syntax-l devsite-syntax-l-Scalar devsite-syntax-l-Scalar-Plain\"\u003eCERTIFICATE_STRING\u003c/span\u003e\u003c/var\u003e\n preferredAuthentication: \u003cvar name=\"auth string\" translate=\"no\"\u003e\u003cspan class=\"devsite-syntax-l devsite-syntax-l-Scalar devsite-syntax-l-Scalar-Plain\"\u003ePREFERRED_AUTHENTICATION\u003c/span\u003e\u003c/var\u003e\n server: \u003c\u003e\n\n # Rest of the resource is managed by Google. DO NOT MODIFY.\n ...\n\n| **Tip:** GKE Identity Service lets you configure multiple OIDC, LDAP, and SAML identity provider configurations in a single `ClientConfig` custom resource (CRD) for client authentication. GKE Identity Service attempts authentication with each CRD in the order they are defined, and stops after the first successful authentication.\n\nYou can configure multiple identity providers in your `ClientConfig` according to your requirements. This streamlines management and provides flexibility, letting you configure diverse authentication methods within a unified configuration resource. The following example `ClientConfig` defines multiple identity providers in the required order of authentication precedence. \n\n apiVersion: v1\n items:\n - apiVersion: authentication.gke.io/v2alpha1\n kind: ClientConfig\n ...\n spec:\n authentication:\n - aws:\n region: us-west-2\n name: AWS Login\n - ldap:\n ...\n - saml:\n ...\n - azureAD:\n ...\n - oidc:\n name: Okta OIDC\n ...\n -oidc:\n name: Google OIDC\n ...\n\nThe following table describes the fields of the ClientConfig `saml` object. The\nfields you need to add depend on your identity provider and the setup options\nchosen by your platform administrator when configuring the provider for GKE Identity Service.\n\nAfter you complete your ClientConfig, save the file, which updates the\nClientConfig on your cluster. If you've made any syntax errors, you are\nprompted to re-edit the configuration to fix them.\n\nWhat's next?\n------------\n\nAfter the configuration is applied, continue to [set up user access to clusters](/kubernetes-engine/enterprise/identity/setup/user-access)."]]