憑證會儲存在服務建立所在的 Space 中,儲存在 Kubernetes 密鑰中。在 GKE 上,這些密鑰會以靜態資料加密,並可視需要使用 KMS 加密。
範例
# Bring an existing database service
kf create-user-provided-service db-service -p '{"url":"mysql://..."}'
# Create a service with tags for autowiring
kf create-user-provided-service db-service -t "mysql,database,sql"
[[["容易理解","easyToUnderstand","thumb-up"],["確實解決了我的問題","solvedMyProblem","thumb-up"],["其他","otherUp","thumb-up"]],[["難以理解","hardToUnderstand","thumb-down"],["資訊或程式碼範例有誤","incorrectInformationOrSampleCode","thumb-down"],["缺少我需要的資訊/範例","missingTheInformationSamplesINeed","thumb-down"],["翻譯問題","translationIssue","thumb-down"],["其他","otherDown","thumb-down"]],["上次更新時間:2025-09-04 (世界標準時間)。"],[],[],null,["# kf create-user-provided-service\n\n### Name\n\n`kf create-user-provided-service` - Create a standalone service instance from existing credentials.\n\n### Synopsis\n\n```\nkf create-user-provided-service SERVICE_INSTANCE [-p CREDENTIALS] [-t TAGS] [flags]\n```\n\n### Description\n\nCreates a standalone service instance from existing credentials.\nUser-provided services can be used to inject credentials for services managed\noutside of Kf into Apps.\n\nCredentials are stored in a Kubernetes Secret in the Space the service is\ncreated in. On GKE these Secrets are encrypted at rest and can optionally\nbe encrypted using KMS.\n\n### Examples\n\n```\n# Bring an existing database service\nkf create-user-provided-service db-service -p '{\"url\":\"mysql://...\"}'\n\n# Create a service with tags for autowiring\nkf create-user-provided-service db-service -t \"mysql,database,sql\"\n```\n\n### Flags\n\n`--async`\n\n: Do not wait for the action to complete on the server before returning.\n\n`-h, --help`\n\n: help for create-user-provided-service\n\n`--mock-class=`\u003cvar translate=\"no\"\u003estring\u003c/var\u003e\n\n: Mock class name to use in VCAP_SERVICES rather than 'user-provided'.\n\n`--mock-plan=`\u003cvar translate=\"no\"\u003estring\u003c/var\u003e\n\n: Mock plan name to use in VCAP_SERVICES rather than blank.\n\n`-p, --parameters=`\u003cvar translate=\"no\"\u003estring\u003c/var\u003e\n\n: JSON object or path to a JSON file containing configuration parameters. (default \"{}\")\n\n`--params=`\u003cvar translate=\"no\"\u003estring\u003c/var\u003e\n\n: JSON object or path to a JSON file containing configuration parameters. DEPRECATED: use --parameters instead. (default \"{}\")\n\n`-r, --route=`\u003cvar translate=\"no\"\u003estring\u003c/var\u003e\n\n: URL to which requests for bound routes will be forwarded. Scheme must be https. NOTE: This is a preivew feature.\n\n`-t, --tags=`\u003cvar translate=\"no\"\u003estring\u003c/var\u003e\n\n: User-defined tags to differentiate services during injection.\n\n### Inherited flags\n\nThese flags are inherited from parent commands.\n\n`--as=`\u003cvar translate=\"no\"\u003estring\u003c/var\u003e\n\n: Username to impersonate for the operation.\n\n`--as-group=`\u003cvar translate=\"no\"\u003estrings\u003c/var\u003e\n\n: Group to impersonate for the operation. Include this flag multiple times to specify multiple groups.\n\n`--config=`\u003cvar translate=\"no\"\u003estring\u003c/var\u003e\n\n: Path to the Kf config file to use for CLI requests.\n\n`--kubeconfig=`\u003cvar translate=\"no\"\u003estring\u003c/var\u003e\n\n: Path to the kubeconfig file to use for CLI requests.\n\n`--log-http`\n\n: Log HTTP requests to standard error.\n\n`--space=`\u003cvar translate=\"no\"\u003estring\u003c/var\u003e\n\n: Space to run the command against. This flag overrides the currently targeted Space."]]