2020-06-19 14:52:56 +08:00
<!DOCTYPE HTML>
< html lang = "zh-hans" >
< head >
< meta charset = "UTF-8" >
< meta content = "text/html; charset=utf-8" http-equiv = "Content-Type" >
< title > Kubernetes 中的用户与身份认证授权 · Kubernetes Handbook - Kubernetes中文指南/云原生应用架构实践手册 by Jimmy Song(宋净超)< / title >
< meta http-equiv = "X-UA-Compatible" content = "IE=edge" / >
< meta name = "description" content = "" >
< meta name = "generator" content = "GitBook 3.2.3" >
< meta name = "author" content = "Jimmy Song( 宋净超) " >
< link rel = "stylesheet" href = "../gitbook/style.css" >
< link rel = "stylesheet" href = "../gitbook/gitbook-plugin-splitter/splitter.css" >
< link rel = "stylesheet" href = "../gitbook/gitbook-plugin-page-toc-button/plugin.css" >
< link rel = "stylesheet" href = "../gitbook/gitbook-plugin-image-captions/image-captions.css" >
< link rel = "stylesheet" href = "../gitbook/gitbook-plugin-back-to-top-button/plugin.css" >
< link rel = "stylesheet" href = "../gitbook/gitbook-plugin-search-plus/search.css" >
< link rel = "stylesheet" href = "../gitbook/gitbook-plugin-tbfed-pagefooter/footer.css" >
< link rel = "stylesheet" href = "../gitbook/gitbook-plugin-prism/prism-ghcolors.css" >
< link rel = "stylesheet" href = "../gitbook/gitbook-plugin-lightbox/css/lightbox.min.css" >
< link rel = "stylesheet" href = "../gitbook/gitbook-plugin-alerts/style.css" >
< link rel = "stylesheet" href = "../gitbook/gitbook-plugin-fontsettings/website.css" >
< meta name = "HandheldFriendly" content = "true" / >
< meta name = "viewport" content = "width=device-width, initial-scale=1, user-scalable=no" >
< meta name = "apple-mobile-web-app-capable" content = "yes" >
< meta name = "apple-mobile-web-app-status-bar-style" content = "black" >
< link rel = "apple-touch-icon-precomposed" sizes = "152x152" href = "../gitbook/images/apple-touch-icon-precomposed-152.png" >
< link rel = "shortcut icon" href = "../gitbook/images/favicon.ico" type = "image/x-icon" >
< link rel = "next" href = "kubernetes-security-best-practice.html" / >
< link rel = "prev" href = "auth-with-kubeconfig-or-token.html" / >
< link rel = "shortcut icon" href = '../favicon.ico' type = "image/x-icon" >
< link rel = "bookmark" href = '../favicon.ico' type = "image/x-icon" >
< style >
@media only screen and (max-width: 640px) {
.book-header .hidden-mobile {
display: none;
}
}
< / style >
< script >
window["gitbook-plugin-github-buttons"] = {"repo":"rootsongjc/kubernetes-handbook","types":["star"],"size":"small"};
< / script >
< / head >
< body >
< div class = "book" >
< div class = "book-summary" >
< div id = "book-search-input" role = "search" >
< input type = "text" placeholder = "输入并搜索" / >
< / div >
< nav role = "navigation" >
< ul class = "summary" >
< li >
< a href = "https://jimmysong.io" target = "_blank" class = "custom-link" > 回到主页< / a >
< / li >
< li >
< a href = "https://jimmysong.io/awesome-cloud-native" target = "_blank" class = "custom-link" > Awesome Cloud Native< / a >
< / li >
< li >
< a href = "https://cloudnative.to" target = "_blank" class = "custom-link" > 云原生社区< / a >
< / li >
< li >
< a href = "https://cloudnativeindustryalliance.github.io/whitepaper2020/" target = "_blank" class = "custom-link" > 中国云原生发展白皮书2020< / a >
< / li >
< li >
< a href = "https://jimmysong.io/guide-to-cloud-native-app/" target = "_blank" class = "custom-link" > 云原生应用白皮书< / a >
< / li >
< li class = "divider" > < / li >
< li class = "header" > 前言< / li >
< li class = "chapter " data-level = "1.1" data-path = "../" >
< a href = "../" >
< b > 1.1.< / b >
序言
< / a >
< / li >
< li class = "header" > 云原生< / li >
< li class = "chapter " data-level = "2.1" data-path = "../cloud-native/cloud-native-definition.html" >
< a href = "../cloud-native/cloud-native-definition.html" >
< b > 2.1.< / b >
云原生( Cloud Native) 的定义
< / a >
< / li >
< li class = "chapter " data-level = "2.2" data-path = "../cloud-native/cloud-native-philosophy.html" >
< a href = "../cloud-native/cloud-native-philosophy.html" >
< b > 2.2.< / b >
云原生的设计哲学
< / a >
< / li >
< li class = "chapter " data-level = "2.3" data-path = "../cloud-native/play-with-kubernetes.html" >
< a href = "../cloud-native/play-with-kubernetes.html" >
< b > 2.3.< / b >
Play with Kubernetes
< / a >
< / li >
< li class = "chapter " data-level = "2.4" data-path = "../cloud-native/cloud-native-local-quick-start.html" >
< a href = "../cloud-native/cloud-native-local-quick-start.html" >
< b > 2.4.< / b >
快速部署一个云原生本地实验环境
< / a >
< / li >
< li class = "chapter " data-level = "2.5" data-path = "../cloud-native/setup-kubernetes-with-rancher-and-aliyun.html" >
< a href = "../cloud-native/setup-kubernetes-with-rancher-and-aliyun.html" >
< b > 2.5.< / b >
使用 Rancher 在阿里云上部署 Kubenretes 集群
< / a >
< / li >
< li class = "chapter " data-level = "2.6" data-path = "../cloud-native/kubernetes-and-cloud-native-app-overview.html" >
< a href = "../cloud-native/kubernetes-and-cloud-native-app-overview.html" >
< b > 2.6.< / b >
Kubernetes 与云原生应用概览
< / a >
< / li >
< li class = "chapter " data-level = "2.7" data-path = "../cloud-native/from-kubernetes-to-cloud-native.html" >
< a href = "../cloud-native/from-kubernetes-to-cloud-native.html" >
< b > 2.7.< / b >
云原生应用之路 —— 从 Kubernetes 到 Cloud Native
< / a >
< / li >
< li class = "chapter " data-level = "2.8" data-path = "../cloud-native/cloud-native-programming-languages.html" >
< a href = "../cloud-native/cloud-native-programming-languages.html" >
< b > 2.8.< / b >
云原生编程语言
< / a >
< ul class = "articles" >
< li class = "chapter " data-level = "2.8.1" data-path = "../cloud-native/cloud-native-programming-language-ballerina.html" >
< a href = "../cloud-native/cloud-native-programming-language-ballerina.html" >
< b > 2.8.1.< / b >
云原生编程语言 Ballerina
< / a >
< / li >
< li class = "chapter " data-level = "2.8.2" data-path = "../cloud-native/cloud-native-programming-language-pulumi.html" >
< a href = "../cloud-native/cloud-native-programming-language-pulumi.html" >
< b > 2.8.2.< / b >
云原生编程语言 Pulumi
< / a >
< / li >
< / ul >
< / li >
< li class = "chapter " data-level = "2.9" data-path = "../cloud-native/the-future-of-cloud-native.html" >
< a href = "../cloud-native/the-future-of-cloud-native.html" >
< b > 2.9.< / b >
云原生的未来
< / a >
< / li >
< li class = "chapter " data-level = "2.10" data-path = "../cloud-native/define-cloud-native-app.html" >
< a href = "../cloud-native/define-cloud-native-app.html" >
< b > 2.10.< / b >
定义云原生应用
< / a >
< ul class = "articles" >
< li class = "chapter " data-level = "2.10.1" data-path = "../cloud-native/workload.html" >
< a href = "../cloud-native/workload.html" >
< b > 2.10.1.< / b >
Workload
< / a >
< / li >
< li class = "chapter " data-level = "2.10.2" data-path = "../cloud-native/component.html" >
< a href = "../cloud-native/component.html" >
< b > 2.10.2.< / b >
Component
< / a >
< / li >
< li class = "chapter " data-level = "2.10.3" data-path = "../cloud-native/trait.html" >
< a href = "../cloud-native/trait.html" >
< b > 2.10.3.< / b >
Trait
< / a >
< / li >
< li class = "chapter " data-level = "2.10.4" data-path = "../cloud-native/application-scope.html" >
< a href = "../cloud-native/application-scope.html" >
< b > 2.10.4.< / b >
Application Scope
< / a >
< / li >
< li class = "chapter " data-level = "2.10.5" data-path = "../cloud-native/application-configuration.html" >
< a href = "../cloud-native/application-configuration.html" >
< b > 2.10.5.< / b >
Application Configuration
< / a >
< / li >
< / ul >
< / li >
< li class = "header" > 概念与原理< / li >
< li class = "chapter " data-level = "3.1" data-path = "../concepts/" >
< a href = "../concepts/" >
< b > 3.1.< / b >
Kubernetes 架构
< / a >
< ul class = "articles" >
< li class = "chapter " data-level = "3.1.1" data-path = "../concepts/concepts.html" >
< a href = "../concepts/concepts.html" >
< b > 3.1.1.< / b >
设计理念
< / a >
< / li >
< li class = "chapter " data-level = "3.1.2" data-path = "../concepts/etcd.html" >
< a href = "../concepts/etcd.html" >
< b > 3.1.2.< / b >
Etcd 解析
< / a >
< / li >
< li class = "chapter " data-level = "3.1.3" data-path = "../concepts/open-interfaces.html" >
< a href = "../concepts/open-interfaces.html" >
< b > 3.1.3.< / b >
开放接口
< / a >
< ul class = "articles" >
< li class = "chapter " data-level = "3.1.3.1" data-path = "../concepts/cri.html" >
< a href = "../concepts/cri.html" >
< b > 3.1.3.1.< / b >
CRI - Container Runtime Interface( 容器运行时接口)
< / a >
< / li >
< li class = "chapter " data-level = "3.1.3.2" data-path = "../concepts/cni.html" >
< a href = "../concepts/cni.html" >
< b > 3.1.3.2.< / b >
CNI - Container Network Interface( 容器网络接口)
< / a >
< / li >
< li class = "chapter " data-level = "3.1.3.3" data-path = "../concepts/csi.html" >
< a href = "../concepts/csi.html" >
< b > 3.1.3.3.< / b >
CSI - Container Storage Interface( 容器存储接口)
< / a >
< / li >
< / ul >
< / li >
< / ul >
< / li >
< li class = "chapter " data-level = "3.2" data-path = "../concepts/networking.html" >
< a href = "../concepts/networking.html" >
< b > 3.2.< / b >
Kubernetes 中的网络
< / a >
< ul class = "articles" >
< li class = "chapter " data-level = "3.2.1" data-path = "../concepts/flannel.html" >
< a href = "../concepts/flannel.html" >
< b > 3.2.1.< / b >
Kubernetes 中的网络解析 —— 以 flannel 为例
< / a >
< / li >
< li class = "chapter " data-level = "3.2.2" data-path = "../concepts/calico.html" >
< a href = "../concepts/calico.html" >
< b > 3.2.2.< / b >
Kubernetes 中的网络解析 —— 以 calico 为例
< / a >
< / li >
< li class = "chapter " data-level = "3.2.3" data-path = "../concepts/cilium.html" >
< a href = "../concepts/cilium.html" >
< b > 3.2.3.< / b >
具备 API 感知的网络和安全性管理开源软件 Cilium
< / a >
< ul class = "articles" >
< li class = "chapter " data-level = "3.2.3.1" data-path = "../concepts/cilium-concepts.html" >
< a href = "../concepts/cilium-concepts.html" >
< b > 3.2.3.1.< / b >
Cilium 架构设计与概念解析
< / a >
< / li >
< / ul >
< / li >
< / ul >
< / li >
< li class = "chapter " data-level = "3.3" data-path = "../concepts/objects.html" >
< a href = "../concepts/objects.html" >
< b > 3.3.< / b >
资源对象与基本概念解析
< / a >
< / li >
< li class = "chapter " data-level = "3.4" data-path = "../concepts/pod-state-and-lifecycle.html" >
< a href = "../concepts/pod-state-and-lifecycle.html" >
< b > 3.4.< / b >
Pod 状态与生命周期管理
< / a >
< ul class = "articles" >
< li class = "chapter " data-level = "3.4.1" data-path = "../concepts/pod-overview.html" >
< a href = "../concepts/pod-overview.html" >
< b > 3.4.1.< / b >
Pod 概览
< / a >
< / li >
< li class = "chapter " data-level = "3.4.2" data-path = "../concepts/pod.html" >
< a href = "../concepts/pod.html" >
< b > 3.4.2.< / b >
Pod 解析
< / a >
< / li >
< li class = "chapter " data-level = "3.4.3" data-path = "../concepts/init-containers.html" >
< a href = "../concepts/init-containers.html" >
< b > 3.4.3.< / b >
Init 容器
< / a >
< / li >
< li class = "chapter " data-level = "3.4.4" data-path = "../concepts/pause-container.html" >
< a href = "../concepts/pause-container.html" >
< b > 3.4.4.< / b >
Pause 容器
< / a >
< / li >
< li class = "chapter " data-level = "3.4.5" data-path = "../concepts/pod-security-policy.html" >
< a href = "../concepts/pod-security-policy.html" >
< b > 3.4.5.< / b >
Pod 安全策略
< / a >
< / li >
< li class = "chapter " data-level = "3.4.6" data-path = "../concepts/pod-lifecycle.html" >
< a href = "../concepts/pod-lifecycle.html" >
< b > 3.4.6.< / b >
Pod 的生命周期
< / a >
< / li >
< li class = "chapter " data-level = "3.4.7" data-path = "../concepts/pod-hook.html" >
< a href = "../concepts/pod-hook.html" >
< b > 3.4.7.< / b >
Pod Hook
< / a >
< / li >
< li class = "chapter " data-level = "3.4.8" data-path = "../concepts/pod-preset.html" >
< a href = "../concepts/pod-preset.html" >
< b > 3.4.8.< / b >
Pod Preset
< / a >
< / li >
< li class = "chapter " data-level = "3.4.9" data-path = "../concepts/pod-disruption-budget.html" >
< a href = "../concepts/pod-disruption-budget.html" >
< b > 3.4.9.< / b >
Pod 中断与 PDB( Pod 中断预算)
< / a >
< / li >
< / ul >
< / li >
< li class = "chapter " data-level = "3.5" data-path = "../concepts/cluster.html" >
< a href = "../concepts/cluster.html" >
< b > 3.5.< / b >
集群资源管理
< / a >
< ul class = "articles" >
< li class = "chapter " data-level = "3.5.1" data-path = "../concepts/node.html" >
< a href = "../concepts/node.html" >
< b > 3.5.1.< / b >
Node
< / a >
< / li >
< li class = "chapter " data-level = "3.5.2" data-path = "../concepts/namespace.html" >
< a href = "../concepts/namespace.html" >
< b > 3.5.2.< / b >
Namespace
< / a >
< / li >
< li class = "chapter " data-level = "3.5.3" data-path = "../concepts/label.html" >
< a href = "../concepts/label.html" >
< b > 3.5.3.< / b >
Label
< / a >
< / li >
< li class = "chapter " data-level = "3.5.4" data-path = "../concepts/annotation.html" >
< a href = "../concepts/annotation.html" >
< b > 3.5.4.< / b >
Annotation
< / a >
< / li >
< li class = "chapter " data-level = "3.5.5" data-path = "../concepts/taint-and-toleration.html" >
< a href = "../concepts/taint-and-toleration.html" >
< b > 3.5.5.< / b >
Taint 和 Toleration( 污点和容忍)
< / a >
< / li >
< li class = "chapter " data-level = "3.5.6" data-path = "../concepts/garbage-collection.html" >
< a href = "../concepts/garbage-collection.html" >
< b > 3.5.6.< / b >
垃圾收集
< / a >
< / li >
< / ul >
< / li >
< li class = "chapter " data-level = "3.6" data-path = "../concepts/controllers.html" >
< a href = "../concepts/controllers.html" >
< b > 3.6.< / b >
控制器
< / a >
< ul class = "articles" >
< li class = "chapter " data-level = "3.6.1" data-path = "../concepts/deployment.html" >
< a href = "../concepts/deployment.html" >
< b > 3.6.1.< / b >
Deployment
< / a >
< / li >
< li class = "chapter " data-level = "3.6.2" data-path = "../concepts/statefulset.html" >
< a href = "../concepts/statefulset.html" >
< b > 3.6.2.< / b >
StatefulSet
< / a >
< / li >
< li class = "chapter " data-level = "3.6.3" data-path = "../concepts/daemonset.html" >
< a href = "../concepts/daemonset.html" >
< b > 3.6.3.< / b >
DaemonSet
< / a >
< / li >
< li class = "chapter " data-level = "3.6.4" data-path = "../concepts/replicaset.html" >
< a href = "../concepts/replicaset.html" >
< b > 3.6.4.< / b >
ReplicationController 和 ReplicaSet
< / a >
< / li >
< li class = "chapter " data-level = "3.6.5" data-path = "../concepts/job.html" >
< a href = "../concepts/job.html" >
< b > 3.6.5.< / b >
Job
< / a >
< / li >
< li class = "chapter " data-level = "3.6.6" data-path = "../concepts/cronjob.html" >
< a href = "../concepts/cronjob.html" >
< b > 3.6.6.< / b >
CronJob
< / a >
< / li >
< li class = "chapter " data-level = "3.6.7" data-path = "../concepts/horizontal-pod-autoscaling.html" >
< a href = "../concepts/horizontal-pod-autoscaling.html" >
< b > 3.6.7.< / b >
Horizontal Pod Autoscaling
< / a >
< ul class = "articles" >
< li class = "chapter " data-level = "3.6.7.1" data-path = "../concepts/custom-metrics-hpa.html" >
< a href = "../concepts/custom-metrics-hpa.html" >
< b > 3.6.7.1.< / b >
自定义指标 HPA
< / a >
< / li >
< / ul >
< / li >
< li class = "chapter " data-level = "3.6.8" data-path = "../concepts/admission-controller.html" >
< a href = "../concepts/admission-controller.html" >
< b > 3.6.8.< / b >
准入控制器( Admission Controller)
< / a >
< / li >
< / ul >
< / li >
< li class = "chapter " data-level = "3.7" data-path = "../concepts/service-discovery.html" >
< a href = "../concepts/service-discovery.html" >
< b > 3.7.< / b >
服务发现
< / a >
< ul class = "articles" >
< li class = "chapter " data-level = "3.7.1" data-path = "../concepts/service.html" >
< a href = "../concepts/service.html" >
< b > 3.7.1.< / b >
Service
< / a >
< / li >
< li class = "chapter " data-level = "3.7.2" data-path = "../concepts/ingress.html" >
< a href = "../concepts/ingress.html" >
< b > 3.7.2.< / b >
Ingress
< / a >
< ul class = "articles" >
< li class = "chapter " data-level = "3.7.2.1" data-path = "../concepts/traefik-ingress-controller.html" >
< a href = "../concepts/traefik-ingress-controller.html" >
< b > 3.7.2.1.< / b >
Traefik Ingress Controller
< / a >
< / li >
< / ul >
< / li >
< / ul >
< / li >
< li class = "chapter " data-level = "3.8" data-path = "../concepts/authentication-and-permission.html" >
< a href = "../concepts/authentication-and-permission.html" >
< b > 3.8.< / b >
身份与权限控制
< / a >
< ul class = "articles" >
< li class = "chapter " data-level = "3.8.1" data-path = "../concepts/serviceaccount.html" >
< a href = "../concepts/serviceaccount.html" >
< b > 3.8.1.< / b >
ServiceAccount
< / a >
< / li >
< li class = "chapter " data-level = "3.8.2" data-path = "../concepts/rbac.html" >
< a href = "../concepts/rbac.html" >
< b > 3.8.2.< / b >
RBAC—— 基于角色的访问控制
< / a >
< / li >
< li class = "chapter " data-level = "3.8.3" data-path = "../concepts/network-policy.html" >
< a href = "../concepts/network-policy.html" >
< b > 3.8.3.< / b >
NetworkPolicy
< / a >
< / li >
< / ul >
< / li >
< li class = "chapter " data-level = "3.9" data-path = "../concepts/storage.html" >
< a href = "../concepts/storage.html" >
< b > 3.9.< / b >
存储
< / a >
< ul class = "articles" >
< li class = "chapter " data-level = "3.9.1" data-path = "../concepts/secret.html" >
< a href = "../concepts/secret.html" >
< b > 3.9.1.< / b >
Secret
< / a >
< / li >
< li class = "chapter " data-level = "3.9.2" data-path = "../concepts/configmap.html" >
< a href = "../concepts/configmap.html" >
< b > 3.9.2.< / b >
ConfigMap
< / a >
< ul class = "articles" >
< li class = "chapter " data-level = "3.9.2.1" data-path = "../concepts/configmap-hot-update.html" >
< a href = "../concepts/configmap-hot-update.html" >
< b > 3.9.2.1.< / b >
ConfigMap 的热更新
< / a >
< / li >
< / ul >
< / li >
< li class = "chapter " data-level = "3.9.3" data-path = "../concepts/volume.html" >
< a href = "../concepts/volume.html" >
< b > 3.9.3.< / b >
Volume
< / a >
< / li >
< li class = "chapter " data-level = "3.9.4" data-path = "../concepts/persistent-volume.html" >
< a href = "../concepts/persistent-volume.html" >
< b > 3.9.4.< / b >
Persistent Volume( 持久化卷)
< / a >
< / li >
< li class = "chapter " data-level = "3.9.5" data-path = "../concepts/storageclass.html" >
< a href = "../concepts/storageclass.html" >
< b > 3.9.5.< / b >
Storage Class
< / a >
< / li >
< li class = "chapter " data-level = "3.9.6" data-path = "../concepts/local-persistent-storage.html" >
< a href = "../concepts/local-persistent-storage.html" >
< b > 3.9.6.< / b >
本地持久化存储
< / a >
< / li >
< / ul >
< / li >
< li class = "chapter " data-level = "3.10" data-path = "../concepts/extension.html" >
< a href = "../concepts/extension.html" >
< b > 3.10.< / b >
集群扩展
< / a >
< ul class = "articles" >
< li class = "chapter " data-level = "3.10.1" data-path = "../concepts/custom-resource.html" >
< a href = "../concepts/custom-resource.html" >
< b > 3.10.1.< / b >
使用自定义资源扩展 API
< / a >
< / li >
< li class = "chapter " data-level = "3.10.2" data-path = "../concepts/crd.html" >
< a href = "../concepts/crd.html" >
< b > 3.10.2.< / b >
使用 CRD 扩展 Kubernetes API
< / a >
< / li >
< li class = "chapter " data-level = "3.10.3" data-path = "../concepts/aggregated-api-server.html" >
< a href = "../concepts/aggregated-api-server.html" >
< b > 3.10.3.< / b >
Aggregated API Server
< / a >
< / li >
< li class = "chapter " data-level = "3.10.4" data-path = "../concepts/apiservice.html" >
< a href = "../concepts/apiservice.html" >
< b > 3.10.4.< / b >
APIService
< / a >
< / li >
< li class = "chapter " data-level = "3.10.5" data-path = "../concepts/service-catalog.html" >
< a href = "../concepts/service-catalog.html" >
< b > 3.10.5.< / b >
Service Catalog
< / a >
< / li >
< / ul >
< / li >
< li class = "chapter " data-level = "3.11" data-path = "../concepts/scheduling.html" >
< a href = "../concepts/scheduling.html" >
< b > 3.11.< / b >
资源调度
< / a >
< ul class = "articles" >
< li class = "chapter " data-level = "3.11.1" data-path = "../concepts/qos.html" >
< a href = "../concepts/qos.html" >
< b > 3.11.1.< / b >
QoS( 服务质量等级)
< / a >
< / li >
< / ul >
< / li >
< li class = "header" > 用户指南< / li >
< li class = "chapter " data-level = "4.1" data-path = "./" >
< a href = "./" >
< b > 4.1.< / b >
用户指南
< / a >
< / li >
< li class = "chapter " data-level = "4.2" data-path = "resource-configuration.html" >
< a href = "resource-configuration.html" >
< b > 4.2.< / b >
资源对象配置
< / a >
< ul class = "articles" >
< li class = "chapter " data-level = "4.2.1" data-path = "configure-liveness-readiness-probes.html" >
< a href = "configure-liveness-readiness-probes.html" >
< b > 4.2.1.< / b >
配置 Pod 的 liveness 和 readiness 探针
< / a >
< / li >
< li class = "chapter " data-level = "4.2.2" data-path = "configure-pod-service-account.html" >
< a href = "configure-pod-service-account.html" >
< b > 4.2.2.< / b >
配置 Pod 的 Service Account
< / a >
< / li >
< li class = "chapter " data-level = "4.2.3" data-path = "secret-configuration.html" >
< a href = "secret-configuration.html" >
< b > 4.2.3.< / b >
Secret 配置
< / a >
< / li >
< li class = "chapter " data-level = "4.2.4" data-path = "resource-quota-management.html" >
< a href = "resource-quota-management.html" >
< b > 4.2.4.< / b >
管理 namespace 中的资源配额
< / a >
< / li >
< / ul >
< / li >
< li class = "chapter " data-level = "4.3" data-path = "command-usage.html" >
< a href = "command-usage.html" >
< b > 4.3.< / b >
命令使用
< / a >
< ul class = "articles" >
< li class = "chapter " data-level = "4.3.1" data-path = "docker-cli-to-kubectl.html" >
< a href = "docker-cli-to-kubectl.html" >
< b > 4.3.1.< / b >
Docker 用户过渡到 kubectl 命令行指南
< / a >
< / li >
< li class = "chapter " data-level = "4.3.2" data-path = "using-kubectl.html" >
< a href = "using-kubectl.html" >
< b > 4.3.2.< / b >
kubectl 命令概览
< / a >
< / li >
< li class = "chapter " data-level = "4.3.3" data-path = "kubectl-cheatsheet.html" >
< a href = "kubectl-cheatsheet.html" >
< b > 4.3.3.< / b >
kubectl 命令技巧大全
< / a >
< / li >
< li class = "chapter " data-level = "4.3.4" data-path = "using-etcdctl-to-access-kubernetes-data.html" >
< a href = "using-etcdctl-to-access-kubernetes-data.html" >
< b > 4.3.4.< / b >
使用 etcdctl 访问 kubernetes 数据
< / a >
< / li >
< / ul >
< / li >
< li class = "chapter " data-level = "4.4" data-path = "cluster-security-management.html" >
< a href = "cluster-security-management.html" >
< b > 4.4.< / b >
集群安全性管理
< / a >
< ul class = "articles" >
< li class = "chapter " data-level = "4.4.1" data-path = "managing-tls-in-a-cluster.html" >
< a href = "managing-tls-in-a-cluster.html" >
< b > 4.4.1.< / b >
管理集群中的 TLS
< / a >
< / li >
< li class = "chapter " data-level = "4.4.2" data-path = "kubelet-authentication-authorization.html" >
< a href = "kubelet-authentication-authorization.html" >
< b > 4.4.2.< / b >
kubelet 的认证授权
< / a >
< / li >
< li class = "chapter " data-level = "4.4.3" data-path = "tls-bootstrapping.html" >
< a href = "tls-bootstrapping.html" >
< b > 4.4.3.< / b >
TLS bootstrap
< / a >
< / li >
< li class = "chapter " data-level = "4.4.4" data-path = "kubectl-user-authentication-authorization.html" >
< a href = "kubectl-user-authentication-authorization.html" >
< b > 4.4.4.< / b >
创建用户认证授权的 kubeconfig 文件
< / a >
< / li >
< li class = "chapter " data-level = "4.4.5" data-path = "ip-masq-agent.html" >
< a href = "ip-masq-agent.html" >
< b > 4.4.5.< / b >
IP 伪装代理
< / a >
< / li >
< li class = "chapter " data-level = "4.4.6" data-path = "auth-with-kubeconfig-or-token.html" >
< a href = "auth-with-kubeconfig-or-token.html" >
< b > 4.4.6.< / b >
使用 kubeconfig 或 token 进行用户身份认证
< / a >
< / li >
< li class = "chapter active" data-level = "4.4.7" data-path = "authentication.html" >
< a href = "authentication.html" >
< b > 4.4.7.< / b >
Kubernetes 中的用户与身份认证授权
< / a >
< / li >
< li class = "chapter " data-level = "4.4.8" data-path = "kubernetes-security-best-practice.html" >
< a href = "kubernetes-security-best-practice.html" >
< b > 4.4.8.< / b >
Kubernetes 集群安全性配置最佳实践
< / a >
< / li >
< / ul >
< / li >
< li class = "chapter " data-level = "4.5" data-path = "access-kubernetes-cluster.html" >
< a href = "access-kubernetes-cluster.html" >
< b > 4.5.< / b >
访问 Kubernetes 集群
< / a >
< ul class = "articles" >
< li class = "chapter " data-level = "4.5.1" data-path = "access-cluster.html" >
< a href = "access-cluster.html" >
< b > 4.5.1.< / b >
访问集群
< / a >
< / li >
< li class = "chapter " data-level = "4.5.2" data-path = "authenticate-across-clusters-kubeconfig.html" >
< a href = "authenticate-across-clusters-kubeconfig.html" >
< b > 4.5.2.< / b >
使用 kubeconfig 文件配置跨集群认证
< / a >
< / li >
< li class = "chapter " data-level = "4.5.3" data-path = "connecting-to-applications-port-forward.html" >
< a href = "connecting-to-applications-port-forward.html" >
< b > 4.5.3.< / b >
通过端口转发访问集群中的应用程序
< / a >
< / li >
< li class = "chapter " data-level = "4.5.4" data-path = "service-access-application-cluster.html" >
< a href = "service-access-application-cluster.html" >
< b > 4.5.4.< / b >
使用 service 访问群集中的应用程序
< / a >
< / li >
< li class = "chapter " data-level = "4.5.5" data-path = "accessing-kubernetes-pods-from-outside-of-the-cluster.html" >
< a href = "accessing-kubernetes-pods-from-outside-of-the-cluster.html" >
< b > 4.5.5.< / b >
从外部访问 Kubernetes 中的 Pod
< / a >
< / li >
< li class = "chapter " data-level = "4.5.6" data-path = "cabin-mobile-dashboard-for-kubernetes.html" >
< a href = "cabin-mobile-dashboard-for-kubernetes.html" >
< b > 4.5.6.< / b >
Cabin - Kubernetes 手机客户端
< / a >
< / li >
< li class = "chapter " data-level = "4.5.7" data-path = "kubernetes-desktop-client.html" >
< a href = "kubernetes-desktop-client.html" >
< b > 4.5.7.< / b >
Kubernetic - Kubernetes 桌面客户端
< / a >
< / li >
< li class = "chapter " data-level = "4.5.8" data-path = "kubernator-kubernetes-ui.html" >
< a href = "kubernator-kubernetes-ui.html" >
< b > 4.5.8.< / b >
Kubernator - 更底层的 Kubernetes UI
< / a >
< / li >
< / ul >
< / li >
< li class = "chapter " data-level = "4.6" data-path = "application-development-deployment-flow.html" >
< a href = "application-development-deployment-flow.html" >
< b > 4.6.< / b >
在 Kubernetes 中开发部署应用
< / a >
< ul class = "articles" >
< li class = "chapter " data-level = "4.6.1" data-path = "deploy-applications-in-kubernetes.html" >
< a href = "deploy-applications-in-kubernetes.html" >
< b > 4.6.1.< / b >
适用于 kubernetes 的应用开发部署流程
< / a >
< / li >
< li class = "chapter " data-level = "4.6.2" data-path = "migrating-hadoop-yarn-to-kubernetes.html" >
< a href = "migrating-hadoop-yarn-to-kubernetes.html" >
< b > 4.6.2.< / b >
迁移传统应用到 Kubernetes 中 —— 以 Hadoop YARN 为例
< / a >
< / li >
< li class = "chapter " data-level = "4.6.3" data-path = "using-statefulset.html" >
< a href = "using-statefulset.html" >
< b > 4.6.3.< / b >
使用 StatefulSet 部署用状态应用
< / a >
< / li >
< / ul >
< / li >
< li class = "header" > 最佳实践< / li >
< li class = "chapter " data-level = "5.1" data-path = "../practice/" >
< a href = "../practice/" >
< b > 5.1.< / b >
最佳实践概览
< / a >
< / li >
< li class = "chapter " data-level = "5.2" data-path = "../practice/install-kubernetes-on-centos.html" >
< a href = "../practice/install-kubernetes-on-centos.html" >
< b > 5.2.< / b >
在 CentOS 上部署 Kubernetes 集群
< / a >
< ul class = "articles" >
< li class = "chapter " data-level = "5.2.1" data-path = "../practice/create-tls-and-secret-key.html" >
< a href = "../practice/create-tls-and-secret-key.html" >
< b > 5.2.1.< / b >
创建 TLS 证书和秘钥
< / a >
< / li >
< li class = "chapter " data-level = "5.2.2" data-path = "../practice/create-kubeconfig.html" >
< a href = "../practice/create-kubeconfig.html" >
< b > 5.2.2.< / b >
创建 kubeconfig 文件
< / a >
< / li >
< li class = "chapter " data-level = "5.2.3" data-path = "../practice/etcd-cluster-installation.html" >
< a href = "../practice/etcd-cluster-installation.html" >
< b > 5.2.3.< / b >
创建高可用 etcd 集群
< / a >
< / li >
< li class = "chapter " data-level = "5.2.4" data-path = "../practice/kubectl-installation.html" >
< a href = "../practice/kubectl-installation.html" >
< b > 5.2.4.< / b >
安装 kubectl 命令行工具
< / a >
< / li >
< li class = "chapter " data-level = "5.2.5" data-path = "../practice/master-installation.html" >
< a href = "../practice/master-installation.html" >
< b > 5.2.5.< / b >
部署 master 节点
< / a >
< / li >
< li class = "chapter " data-level = "5.2.6" data-path = "../practice/flannel-installation.html" >
< a href = "../practice/flannel-installation.html" >
< b > 5.2.6.< / b >
安装 flannel 网络插件
< / a >
< / li >
< li class = "chapter " data-level = "5.2.7" data-path = "../practice/node-installation.html" >
< a href = "../practice/node-installation.html" >
< b > 5.2.7.< / b >
部署 node 节点
< / a >
< / li >
< li class = "chapter " data-level = "5.2.8" data-path = "../practice/kubedns-addon-installation.html" >
< a href = "../practice/kubedns-addon-installation.html" >
< b > 5.2.8.< / b >
安装 kubedns 插件
< / a >
< / li >
< li class = "chapter " data-level = "5.2.9" data-path = "../practice/dashboard-addon-installation.html" >
< a href = "../practice/dashboard-addon-installation.html" >
< b > 5.2.9.< / b >
安装 dashboard 插件
< / a >
< / li >
< li class = "chapter " data-level = "5.2.10" data-path = "../practice/heapster-addon-installation.html" >
< a href = "../practice/heapster-addon-installation.html" >
< b > 5.2.10.< / b >
安装 heapster 插件
< / a >
< / li >
< li class = "chapter " data-level = "5.2.11" data-path = "../practice/efk-addon-installation.html" >
< a href = "../practice/efk-addon-installation.html" >
< b > 5.2.11.< / b >
安装 EFK 插件
< / a >
< / li >
< / ul >
< / li >
< li class = "chapter " data-level = "5.3" data-path = "../practice/install-kubernetes-with-kubeadm.html" >
< a href = "../practice/install-kubernetes-with-kubeadm.html" >
< b > 5.3.< / b >
生产级的 Kubernetes 简化管理工具 kubeadm
< / a >
< ul class = "articles" >
< li class = "chapter " data-level = "5.3.1" data-path = "../practice/install-kubernetes-on-ubuntu-server-16.04-with-kubeadm.html" >
< a href = "../practice/install-kubernetes-on-ubuntu-server-16.04-with-kubeadm.html" >
< b > 5.3.1.< / b >
使用 kubeadm 在 Ubuntu Server 16.04 上快速构建测试集群
< / a >
< / li >
< / ul >
< / li >
< li class = "chapter " data-level = "5.4" data-path = "../practice/service-discovery-and-loadbalancing.html" >
< a href = "../practice/service-discovery-and-loadbalancing.html" >
< b > 5.4.< / b >
服务发现与负载均衡
< / a >
< ul class = "articles" >
< li class = "chapter " data-level = "5.4.1" data-path = "../practice/traefik-ingress-installation.html" >
< a href = "../practice/traefik-ingress-installation.html" >
< b > 5.4.1.< / b >
安装 Traefik ingress
< / a >
< / li >
< li class = "chapter " data-level = "5.4.2" data-path = "../practice/distributed-load-test.html" >
< a href = "../practice/distributed-load-test.html" >
< b > 5.4.2.< / b >
分布式负载测试
< / a >
< / li >
< li class = "chapter " data-level = "5.4.3" data-path = "../practice/network-and-cluster-perfermance-test.html" >
< a href = "../practice/network-and-cluster-perfermance-test.html" >
< b > 5.4.3.< / b >
网络和集群性能测试
< / a >
< / li >
< li class = "chapter " data-level = "5.4.4" data-path = "../practice/edge-node-configuration.html" >
< a href = "../practice/edge-node-configuration.html" >
< b > 5.4.4.< / b >
边缘节点配置
< / a >
< / li >
< li class = "chapter " data-level = "5.4.5" data-path = "../practice/nginx-ingress-installation.html" >
< a href = "../practice/nginx-ingress-installation.html" >
< b > 5.4.5.< / b >
安装 Nginx ingress
< / a >
< / li >
< li class = "chapter " data-level = "5.4.6" data-path = "../practice/dns-installation.html" >
< a href = "../practice/dns-installation.html" >
< b > 5.4.6.< / b >
安装配置 DNS
< / a >
< ul class = "articles" >
< li class = "chapter " data-level = "5.4.6.1" data-path = "../practice/configuring-dns.html" >
< a href = "../practice/configuring-dns.html" >
< b > 5.4.6.1.< / b >
安装配置 Kube-dns
< / a >
< / li >
< li class = "chapter " data-level = "5.4.6.2" data-path = "../practice/coredns.html" >
< a href = "../practice/coredns.html" >
< b > 5.4.6.2.< / b >
安装配置 CoreDNS
< / a >
< / li >
< / ul >
< / li >
< / ul >
< / li >
< li class = "chapter " data-level = "5.5" data-path = "../practice/operation.html" >
< a href = "../practice/operation.html" >
< b > 5.5.< / b >
运维管理
< / a >
< ul class = "articles" >
< li class = "chapter " data-level = "5.5.1" data-path = "../practice/master-ha.html" >
< a href = "../practice/master-ha.html" >
< b > 5.5.1.< / b >
Master 节点高可用
< / a >
< / li >
< li class = "chapter " data-level = "5.5.2" data-path = "../practice/service-rolling-update.html" >
< a href = "../practice/service-rolling-update.html" >
< b > 5.5.2.< / b >
服务滚动升级
< / a >
< / li >
< li class = "chapter " data-level = "5.5.3" data-path = "../practice/app-log-collection.html" >
< a href = "../practice/app-log-collection.html" >
< b > 5.5.3.< / b >
应用日志收集
< / a >
< / li >
< li class = "chapter " data-level = "5.5.4" data-path = "../practice/configuration-best-practice.html" >
< a href = "../practice/configuration-best-practice.html" >
< b > 5.5.4.< / b >
配置最佳实践
< / a >
< / li >
< li class = "chapter " data-level = "5.5.5" data-path = "../practice/monitor.html" >
< a href = "../practice/monitor.html" >
< b > 5.5.5.< / b >
集群及应用监控
< / a >
< / li >
< li class = "chapter " data-level = "5.5.6" data-path = "../practice/data-persistence-problem.html" >
< a href = "../practice/data-persistence-problem.html" >
< b > 5.5.6.< / b >
数据持久化问题
< / a >
< / li >
< li class = "chapter " data-level = "5.5.7" data-path = "../practice/manage-compute-resources-container.html" >
< a href = "../practice/manage-compute-resources-container.html" >
< b > 5.5.7.< / b >
管理容器的计算资源
< / a >
< / li >
< li class = "chapter " data-level = "5.5.8" data-path = "../practice/federation.html" >
< a href = "../practice/federation.html" >
< b > 5.5.8.< / b >
集群联邦
< / a >
< / li >
< / ul >
< / li >
< li class = "chapter " data-level = "5.6" data-path = "../practice/storage.html" >
< a href = "../practice/storage.html" >
< b > 5.6.< / b >
存储管理
< / a >
< ul class = "articles" >
< li class = "chapter " data-level = "5.6.1" data-path = "../practice/glusterfs.html" >
< a href = "../practice/glusterfs.html" >
< b > 5.6.1.< / b >
GlusterFS
< / a >
< ul class = "articles" >
< li class = "chapter " data-level = "5.6.1.1" data-path = "../practice/using-glusterfs-for-persistent-storage.html" >
< a href = "../practice/using-glusterfs-for-persistent-storage.html" >
< b > 5.6.1.1.< / b >
使用 GlusterFS 做持久化存储
< / a >
< / li >
< li class = "chapter " data-level = "5.6.1.2" data-path = "../practice/using-heketi-gluster-for-persistent-storage.html" >
< a href = "../practice/using-heketi-gluster-for-persistent-storage.html" >
< b > 5.6.1.2.< / b >
使用 Heketi 作为 Kubernetes 的持久存储 GlusterFS 的 external provisioner
< / a >
< / li >
< li class = "chapter " data-level = "5.6.1.3" data-path = "../practice/storage-for-containers-using-glusterfs-with-openshift.html" >
< a href = "../practice/storage-for-containers-using-glusterfs-with-openshift.html" >
< b > 5.6.1.3.< / b >
在 OpenShift 中使用 GlusterFS 做持久化存储
< / a >
< / li >
< / ul >
< / li >
< li class = "chapter " data-level = "5.6.2" data-path = "../practice/glusterd-2.0.html" >
< a href = "../practice/glusterd-2.0.html" >
< b > 5.6.2.< / b >
GlusterD-2.0
< / a >
< / li >
< li class = "chapter " data-level = "5.6.3" data-path = "../practice/ceph.html" >
< a href = "../practice/ceph.html" >
< b > 5.6.3.< / b >
Ceph
< / a >
< ul class = "articles" >
< li class = "chapter " data-level = "5.6.3.1" data-path = "../practice/ceph-helm-install-guide-zh.html" >
< a href = "../practice/ceph-helm-install-guide-zh.html" >
< b > 5.6.3.1.< / b >
用 Helm 托管安装 Ceph 集群并提供后端存储
< / a >
< / li >
< li class = "chapter " data-level = "5.6.3.2" data-path = "../practice/using-ceph-for-persistent-storage.html" >
< a href = "../practice/using-ceph-for-persistent-storage.html" >
< b > 5.6.3.2.< / b >
使用 Ceph 做持久化存储
< / a >
< / li >
< li class = "chapter " data-level = "5.6.3.3" data-path = "../practice/rbd-provisioner.html" >
< a href = "../practice/rbd-provisioner.html" >
< b > 5.6.3.3.< / b >
使用 rbd-provisioner 提供 rbd 持久化存储
< / a >
< / li >
< / ul >
< / li >
< li class = "chapter " data-level = "5.6.4" data-path = "../practice/openebs.html" >
< a href = "../practice/openebs.html" >
< b > 5.6.4.< / b >
OpenEBS
< / a >
< ul class = "articles" >
< li class = "chapter " data-level = "5.6.4.1" data-path = "../practice/using-openebs-for-persistent-storage.html" >
< a href = "../practice/using-openebs-for-persistent-storage.html" >
< b > 5.6.4.1.< / b >
使用 OpenEBS 做持久化存储
< / a >
< / li >
< / ul >
< / li >
< li class = "chapter " data-level = "5.6.5" data-path = "../practice/rook.html" >
< a href = "../practice/rook.html" >
< b > 5.6.5.< / b >
Rook
< / a >
< / li >
< li class = "chapter " data-level = "5.6.6" data-path = "../practice/nfs.html" >
< a href = "../practice/nfs.html" >
< b > 5.6.6.< / b >
NFS
< / a >
< ul class = "articles" >
< li class = "chapter " data-level = "5.6.6.1" data-path = "../practice/using-nfs-for-persistent-storage.html" >
< a href = "../practice/using-nfs-for-persistent-storage.html" >
< b > 5.6.6.1.< / b >
利用 NFS 动态提供 Kubernetes 后端存储卷
< / a >
< / li >
< / ul >
< / li >
< / ul >
< / li >
< li class = "chapter " data-level = "5.7" data-path = "../practice/monitoring.html" >
< a href = "../practice/monitoring.html" >
< b > 5.7.< / b >
集群与应用监控
< / a >
< ul class = "articles" >
< li class = "chapter " data-level = "5.7.1" data-path = "../practice/heapster.html" >
< a href = "../practice/heapster.html" >
< b > 5.7.1.< / b >
Heapster
< / a >
< ul class = "articles" >
< li class = "chapter " data-level = "5.7.1.1" data-path = "../practice/using-heapster-to-get-object-metrics.html" >
< a href = "../practice/using-heapster-to-get-object-metrics.html" >
< b > 5.7.1.1.< / b >
使用 Heapster 获取集群和对象的 metric 数据
< / a >
< / li >
< / ul >
< / li >
< li class = "chapter " data-level = "5.7.2" data-path = "../practice/prometheus.html" >
< a href = "../practice/prometheus.html" >
< b > 5.7.2.< / b >
Prometheus
< / a >
< ul class = "articles" >
< li class = "chapter " data-level = "5.7.2.1" data-path = "../practice/using-prometheus-to-monitor-kuberentes-cluster.html" >
< a href = "../practice/using-prometheus-to-monitor-kuberentes-cluster.html" >
< b > 5.7.2.1.< / b >
使用 Prometheus 监控 kubernetes 集群
< / a >
< / li >
< li class = "chapter " data-level = "5.7.2.2" data-path = "../practice/promql.html" >
< a href = "../practice/promql.html" >
< b > 5.7.2.2.< / b >
Prometheus 查询语言 PromQL 使用说明
< / a >
< / li >
< / ul >
< / li >
< li class = "chapter " data-level = "5.7.3" data-path = "../practice/vistio-visualize-your-istio-mesh.html" >
< a href = "../practice/vistio-visualize-your-istio-mesh.html" >
< b > 5.7.3.< / b >
使用 Vistio 监控 Istio 服务网格中的流量
< / a >
< / li >
< / ul >
< / li >
< li class = "chapter " data-level = "5.8" data-path = "../practice/distributed-tracing.html" >
< a href = "../practice/distributed-tracing.html" >
< b > 5.8.< / b >
分布式跟踪
< / a >
< ul class = "articles" >
< li class = "chapter " data-level = "5.8.1" data-path = "../practice/opentracing.html" >
< a href = "../practice/opentracing.html" >
< b > 5.8.1.< / b >
OpenTracing
< / a >
< / li >
< / ul >
< / li >
< li class = "chapter " data-level = "5.9" data-path = "../practice/services-management-tool.html" >
< a href = "../practice/services-management-tool.html" >
< b > 5.9.< / b >
服务编排管理
< / a >
< ul class = "articles" >
< li class = "chapter " data-level = "5.9.1" data-path = "../practice/helm.html" >
< a href = "../practice/helm.html" >
< b > 5.9.1.< / b >
使用 Helm 管理 Kubernetes 应用
< / a >
< / li >
< li class = "chapter " data-level = "5.9.2" data-path = "../practice/create-private-charts-repo.html" >
< a href = "../practice/create-private-charts-repo.html" >
< b > 5.9.2.< / b >
构建私有 Chart 仓库
< / a >
< / li >
< / ul >
< / li >
< li class = "chapter " data-level = "5.10" data-path = "../practice/ci-cd.html" >
< a href = "../practice/ci-cd.html" >
< b > 5.10.< / b >
持续集成与发布
< / a >
< ul class = "articles" >
< li class = "chapter " data-level = "5.10.1" data-path = "../practice/jenkins-ci-cd.html" >
< a href = "../practice/jenkins-ci-cd.html" >
< b > 5.10.1.< / b >
使用 Jenkins 进行持续集成与发布
< / a >
< / li >
< li class = "chapter " data-level = "5.10.2" data-path = "../practice/drone-ci-cd.html" >
< a href = "../practice/drone-ci-cd.html" >
< b > 5.10.2.< / b >
使用 Drone 进行持续集成与发布
< / a >
< / li >
< / ul >
< / li >
< li class = "chapter " data-level = "5.11" data-path = "../practice/update-and-upgrade.html" >
< a href = "../practice/update-and-upgrade.html" >
< b > 5.11.< / b >
更新与升级
< / a >
< ul class = "articles" >
< li class = "chapter " data-level = "5.11.1" data-path = "../practice/manually-upgrade.html" >
< a href = "../practice/manually-upgrade.html" >
< b > 5.11.1.< / b >
手动升级 Kubernetes 集群
< / a >
< / li >
< li class = "chapter " data-level = "5.11.2" data-path = "../practice/dashboard-upgrade.html" >
< a href = "../practice/dashboard-upgrade.html" >
< b > 5.11.2.< / b >
升级 dashboard
< / a >
< / li >
< / ul >
< / li >
< li class = "chapter " data-level = "5.12" data-path = "../practice/controller-extended.html" >
< a href = "../practice/controller-extended.html" >
< b > 5.12.< / b >
扩展控制器
< / a >
< ul class = "articles" >
< li class = "chapter " data-level = "5.12.1" data-path = "../practice/openkruise.html" >
< a href = "../practice/openkruise.html" >
< b > 5.12.1.< / b >
OpenKruise
< / a >
2020-06-22 17:07:42 +08:00
< ul class = "articles" >
< li class = "chapter " data-level = "5.12.1.1" data-path = "../practice/in-place-update.html" >
< a href = "../practice/in-place-update.html" >
< b > 5.12.1.1.< / b >
原地升级
< / a >
< / li >
< / ul >
2020-06-19 14:52:56 +08:00
< / li >
< / ul >
< / li >
< li class = "header" > 领域应用< / li >
< li class = "chapter " data-level = "6.1" data-path = "../usecases/" >
< a href = "../usecases/" >
< b > 6.1.< / b >
领域应用概览
< / a >
< / li >
< li class = "chapter " data-level = "6.2" data-path = "../usecases/microservices.html" >
< a href = "../usecases/microservices.html" >
< b > 6.2.< / b >
微服务架构
< / a >
< ul class = "articles" >
< li class = "chapter " data-level = "6.2.1" data-path = "../usecases/service-discovery-in-microservices.html" >
< a href = "../usecases/service-discovery-in-microservices.html" >
< b > 6.2.1.< / b >
微服务中的服务发现
< / a >
< / li >
< li class = "chapter " data-level = "6.2.2" data-path = "../usecases/microservices-for-java-developers.html" >
< a href = "../usecases/microservices-for-java-developers.html" >
< b > 6.2.2.< / b >
使用 Java 构建微服务并发布到 Kubernetes 平台
< / a >
< ul class = "articles" >
< li class = "chapter " data-level = "6.2.2.1" data-path = "../usecases/spring-boot-quick-start-guide.html" >
< a href = "../usecases/spring-boot-quick-start-guide.html" >
< b > 6.2.2.1.< / b >
Spring Boot 快速开始指南
< / a >
< / li >
< / ul >
< / li >
< / ul >
< / li >
< li class = "chapter " data-level = "6.3" data-path = "../usecases/service-mesh.html" >
< a href = "../usecases/service-mesh.html" >
< b > 6.3.< / b >
Service Mesh 服务网格
< / a >
< ul class = "articles" >
< li class = "chapter " data-level = "6.3.1" data-path = "../usecases/the-enterprise-path-to-service-mesh-architectures.html" >
< a href = "../usecases/the-enterprise-path-to-service-mesh-architectures.html" >
< b > 6.3.1.< / b >
企业级服务网格架构
< / a >
< ul class = "articles" >
< li class = "chapter " data-level = "6.3.1.1" data-path = "../usecases/service-mesh-fundamental.html" >
< a href = "../usecases/service-mesh-fundamental.html" >
< b > 6.3.1.1.< / b >
Service Mesh 基础
< / a >
< / li >
< li class = "chapter " data-level = "6.3.1.2" data-path = "../usecases/comparing-service-mesh-technologies.html" >
< a href = "../usecases/comparing-service-mesh-technologies.html" >
< b > 6.3.1.2.< / b >
Service Mesh 技术对比
< / a >
< / li >
< li class = "chapter " data-level = "6.3.1.3" data-path = "../usecases/service-mesh-adoption-and-evolution.html" >
< a href = "../usecases/service-mesh-adoption-and-evolution.html" >
< b > 6.3.1.3.< / b >
采纳和演进
< / a >
< / li >
< li class = "chapter " data-level = "6.3.1.4" data-path = "../usecases/service-mesh-customization-and-integration.html" >
< a href = "../usecases/service-mesh-customization-and-integration.html" >
< b > 6.3.1.4.< / b >
定制和集成
< / a >
< / li >
< li class = "chapter " data-level = "6.3.1.5" data-path = "../usecases/service-mesh-conclusion.html" >
< a href = "../usecases/service-mesh-conclusion.html" >
< b > 6.3.1.5.< / b >
总结
< / a >
< / li >
< / ul >
< / li >
< li class = "chapter " data-level = "6.3.2" data-path = "../usecases/istio.html" >
< a href = "../usecases/istio.html" >
< b > 6.3.2.< / b >
Istio
< / a >
< ul class = "articles" >
< li class = "chapter " data-level = "6.3.2.1" data-path = "../usecases/istio-installation.html" >
< a href = "../usecases/istio-installation.html" >
< b > 6.3.2.1.< / b >
安装并试用 Istio service mesh
< / a >
< / li >
< li class = "chapter " data-level = "6.3.2.2" data-path = "../usecases/sidecar-spec-in-istio.html" >
< a href = "../usecases/sidecar-spec-in-istio.html" >
< b > 6.3.2.2.< / b >
Istio 中 sidecar 的注入规范及示例
< / a >
< / li >
< li class = "chapter " data-level = "6.3.2.3" data-path = "../usecases/istio-community-tips.html" >
< a href = "../usecases/istio-community-tips.html" >
< b > 6.3.2.3.< / b >
如何参与 Istio 社区及注意事项
< / a >
< / li >
< li class = "chapter " data-level = "6.3.2.4" data-path = "../usecases/istio-tutorials-collection.html" >
< a href = "../usecases/istio-tutorials-collection.html" >
< b > 6.3.2.4.< / b >
Istio 免费学习资源汇总
< / a >
< / li >
< li class = "chapter " data-level = "6.3.2.5" data-path = "../usecases/understand-sidecar-injection-and-traffic-hijack-in-istio-service-mesh.html" >
< a href = "../usecases/understand-sidecar-injection-and-traffic-hijack-in-istio-service-mesh.html" >
< b > 6.3.2.5.< / b >
Sidecar 的注入与流量劫持
< / a >
< / li >
< li class = "chapter " data-level = "6.3.2.6" data-path = "../usecases/envoy-sidecar-routing-of-istio-service-mesh-deep-dive.html" >
< a href = "../usecases/envoy-sidecar-routing-of-istio-service-mesh-deep-dive.html" >
< b > 6.3.2.6.< / b >
Envoy Sidecar 代理的路由转发
< / a >
< / li >
< / ul >
< / li >
< li class = "chapter " data-level = "6.3.3" data-path = "../usecases/linkerd.html" >
< a href = "../usecases/linkerd.html" >
< b > 6.3.3.< / b >
Linkerd
< / a >
< ul class = "articles" >
< li class = "chapter " data-level = "6.3.3.1" data-path = "../usecases/linkerd-user-guide.html" >
< a href = "../usecases/linkerd-user-guide.html" >
< b > 6.3.3.1.< / b >
Linkerd 使用指南
< / a >
< / li >
< / ul >
< / li >
< li class = "chapter " data-level = "6.3.4" data-path = "../usecases/conduit.html" >
< a href = "../usecases/conduit.html" >
< b > 6.3.4.< / b >
Conduit
< / a >
< ul class = "articles" >
< li class = "chapter " data-level = "6.3.4.1" data-path = "../usecases/conduit-overview.html" >
< a href = "../usecases/conduit-overview.html" >
< b > 6.3.4.1.< / b >
Condiut 概览
< / a >
< / li >
< li class = "chapter " data-level = "6.3.4.2" data-path = "../usecases/conduit-installation.html" >
< a href = "../usecases/conduit-installation.html" >
< b > 6.3.4.2.< / b >
安装 Conduit
< / a >
< / li >
< / ul >
< / li >
< li class = "chapter " data-level = "6.3.5" data-path = "../usecases/envoy.html" >
< a href = "../usecases/envoy.html" >
< b > 6.3.5.< / b >
Envoy
< / a >
< ul class = "articles" >
< li class = "chapter " data-level = "6.3.5.1" data-path = "../usecases/envoy-terminology.html" >
< a href = "../usecases/envoy-terminology.html" >
< b > 6.3.5.1.< / b >
Envoy 的架构与基本术语
< / a >
< / li >
< li class = "chapter " data-level = "6.3.5.2" data-path = "../usecases/envoy-front-proxy.html" >
< a href = "../usecases/envoy-front-proxy.html" >
< b > 6.3.5.2.< / b >
Envoy 作为前端代理
< / a >
< / li >
< li class = "chapter " data-level = "6.3.5.3" data-path = "../usecases/envoy-mesh-in-kubernetes-tutorial.html" >
< a href = "../usecases/envoy-mesh-in-kubernetes-tutorial.html" >
< b > 6.3.5.3.< / b >
Envoy mesh 教程
< / a >
< / li >
< / ul >
< / li >
< li class = "chapter " data-level = "6.3.6" data-path = "../usecases/mosn.html" >
< a href = "../usecases/mosn.html" >
< b > 6.3.6.< / b >
MOSN
< / a >
< / li >
< / ul >
< / li >
< li class = "chapter " data-level = "6.4" data-path = "../usecases/big-data.html" >
< a href = "../usecases/big-data.html" >
< b > 6.4.< / b >
大数据
< / a >
< ul class = "articles" >
< li class = "chapter " data-level = "6.4.1" data-path = "../usecases/spark-standalone-on-kubernetes.html" >
< a href = "../usecases/spark-standalone-on-kubernetes.html" >
< b > 6.4.1.< / b >
Spark standalone on Kubernetes
< / a >
< / li >
< li class = "chapter " data-level = "6.4.2" data-path = "../usecases/running-spark-with-kubernetes-native-scheduler.html" >
< a href = "../usecases/running-spark-with-kubernetes-native-scheduler.html" >
< b > 6.4.2.< / b >
运行支持 Kubernetes 原生调度的 Spark 程序
< / a >
< / li >
< / ul >
< / li >
< li class = "chapter " data-level = "6.5" data-path = "../usecases/serverless.html" >
< a href = "../usecases/serverless.html" >
< b > 6.5.< / b >
Serverless 架构
< / a >
< ul class = "articles" >
< li class = "chapter " data-level = "6.5.1" data-path = "../usecases/understanding-serverless.html" >
< a href = "../usecases/understanding-serverless.html" >
< b > 6.5.1.< / b >
理解 Serverless
< / a >
< / li >
< li class = "chapter " data-level = "6.5.2" data-path = "../usecases/faas.html" >
< a href = "../usecases/faas.html" >
< b > 6.5.2.< / b >
FaaS( 函数即服务)
< / a >
< ul class = "articles" >
< li class = "chapter " data-level = "6.5.2.1" data-path = "../usecases/openfaas-quick-start.html" >
< a href = "../usecases/openfaas-quick-start.html" >
< b > 6.5.2.1.< / b >
OpenFaaS 快速入门指南
< / a >
< / li >
< / ul >
< / li >
< li class = "chapter " data-level = "6.5.3" data-path = "../usecases/knative.html" >
< a href = "../usecases/knative.html" >
< b > 6.5.3.< / b >
Knative
< / a >
< / li >
< / ul >
< / li >
< li class = "chapter " data-level = "6.6" data-path = "../usecases/cloud-native-app-standard.html" >
< a href = "../usecases/cloud-native-app-standard.html" >
< b > 6.6.< / b >
云原生应用标准
< / a >
< ul class = "articles" >
< li class = "chapter " data-level = "6.6.1" data-path = "../usecases/oam.html" >
< a href = "../usecases/oam.html" >
< b > 6.6.1.< / b >
OAM( 开放应用模型)
< / a >
2020-06-23 21:27:48 +08:00
< / li >
< li class = "chapter " data-level = "6.6.2" data-path = "../usecases/crossplane.html" >
< a href = "../usecases/crossplane.html" >
< b > 6.6.2.< / b >
Crossplane
< / a >
2020-06-19 14:52:56 +08:00
< / li >
< / ul >
< / li >
< li class = "chapter " data-level = "6.7" data-path = "../usecases/edge-computing.html" >
< a href = "../usecases/edge-computing.html" >
< b > 6.7.< / b >
边缘计算
< / a >
< / li >
< li class = "chapter " data-level = "6.8" data-path = "../usecases/ai.html" >
< a href = "../usecases/ai.html" >
< b > 6.8.< / b >
人工智能
< / a >
< / li >
< li class = "header" > 开发指南< / li >
< li class = "chapter " data-level = "7.1" data-path = "../develop/" >
< a href = "../develop/" >
< b > 7.1.< / b >
开发指南概览
< / a >
< / li >
< li class = "chapter " data-level = "7.2" data-path = "../develop/sigs-and-working-group.html" >
< a href = "../develop/sigs-and-working-group.html" >
< b > 7.2.< / b >
SIG 和工作组
< / a >
< / li >
< li class = "chapter " data-level = "7.3" data-path = "../develop/developing-environment.html" >
< a href = "../develop/developing-environment.html" >
< b > 7.3.< / b >
开发环境搭建
< / a >
< ul class = "articles" >
< li class = "chapter " data-level = "7.3.1" data-path = "../develop/using-vagrant-and-virtualbox-for-development.html" >
< a href = "../develop/using-vagrant-and-virtualbox-for-development.html" >
< b > 7.3.1.< / b >
本地分布式开发环境搭建(使用 Vagrant 和 Virtualbox)
< / a >
< / li >
< / ul >
< / li >
< li class = "chapter " data-level = "7.4" data-path = "../develop/testing.html" >
< a href = "../develop/testing.html" >
< b > 7.4.< / b >
单元测试和集成测试
< / a >
< / li >
< li class = "chapter " data-level = "7.5" data-path = "../develop/client-go-sample.html" >
< a href = "../develop/client-go-sample.html" >
< b > 7.5.< / b >
client-go 示例
< / a >
< / li >
< li class = "chapter " data-level = "7.6" data-path = "../develop/operator.html" >
< a href = "../develop/operator.html" >
< b > 7.6.< / b >
Operator
< / a >
< ul class = "articles" >
< li class = "chapter " data-level = "7.6.1" data-path = "../develop/operator-sdk.html" >
< a href = "../develop/operator-sdk.html" >
< b > 7.6.1.< / b >
operator-sdk
< / a >
< / li >
< / ul >
< / li >
< li class = "chapter " data-level = "7.7" data-path = "../develop/kubebuilder.html" >
< a href = "../develop/kubebuilder.html" >
< b > 7.7.< / b >
kubebuilder
< / a >
< ul class = "articles" >
< li class = "chapter " data-level = "7.7.1" data-path = "../develop/kubebuilder-example.html" >
< a href = "../develop/kubebuilder-example.html" >
< b > 7.7.1.< / b >
使用 kubebuilder 创建 operator 示例
< / a >
< / li >
< / ul >
< / li >
< li class = "chapter " data-level = "7.8" data-path = "../develop/advance-developer.html" >
< a href = "../develop/advance-developer.html" >
< b > 7.8.< / b >
高级开发指南
< / a >
< / li >
< li class = "chapter " data-level = "7.9" data-path = "../develop/contribute.html" >
< a href = "../develop/contribute.html" >
< b > 7.9.< / b >
社区贡献
< / a >
< / li >
< li class = "chapter " data-level = "7.10" data-path = "../develop/minikube.html" >
< a href = "../develop/minikube.html" >
< b > 7.10.< / b >
Minikube
< / a >
< / li >
< li class = "header" > CNCF( 云原生计算基金会) < / li >
< li class = "chapter " data-level = "8.1" data-path = "../cloud-native/cncf.html" >
< a href = "../cloud-native/cncf.html" >
< b > 8.1.< / b >
CNCF - 云原生计算基金会简介
< / a >
< / li >
< li class = "chapter " data-level = "8.2" data-path = "../cloud-native/cncf-charter.html" >
< a href = "../cloud-native/cncf-charter.html" >
< b > 8.2.< / b >
CNCF 章程
< / a >
< / li >
< li class = "chapter " data-level = "8.3" data-path = "../cloud-native/cncf-sig.html" >
< a href = "../cloud-native/cncf-sig.html" >
< b > 8.3.< / b >
CNCF 特别兴趣小组( SIG) 说明
< / a >
< / li >
< li class = "chapter " data-level = "8.4" data-path = "../cloud-native/cncf-sandbox-criteria.html" >
< a href = "../cloud-native/cncf-sandbox-criteria.html" >
< b > 8.4.< / b >
开源项目加入 CNCF Sandbox 的要求
< / a >
< / li >
< li class = "chapter " data-level = "8.5" data-path = "../cloud-native/cncf-project-governing.html" >
< a href = "../cloud-native/cncf-project-governing.html" >
< b > 8.5.< / b >
CNCF 中的项目治理
< / a >
< / li >
< li class = "chapter " data-level = "8.6" data-path = "../cloud-native/cncf-ambassador.html" >
< a href = "../cloud-native/cncf-ambassador.html" >
< b > 8.6.< / b >
CNCF Ambassador
< / a >
< / li >
< li class = "header" > 附录< / li >
< li class = "chapter " data-level = "9.1" data-path = "../appendix/" >
< a href = "../appendix/" >
< b > 9.1.< / b >
附录说明
< / a >
< / li >
< li class = "chapter " data-level = "9.2" data-path = "../appendix/debug-kubernetes-services.html" >
< a href = "../appendix/debug-kubernetes-services.html" >
< b > 9.2.< / b >
Kubernetes 中的应用故障排查
< / a >
< / li >
< li class = "chapter " data-level = "9.3" data-path = "../appendix/material-share.html" >
< a href = "../appendix/material-share.html" >
< b > 9.3.< / b >
Kubernetes 相关资讯和情报链接
< / a >
< / li >
< li class = "chapter " data-level = "9.4" data-path = "../appendix/docker-best-practice.html" >
< a href = "../appendix/docker-best-practice.html" >
< b > 9.4.< / b >
Docker 最佳实践
< / a >
< / li >
< li class = "chapter " data-level = "9.5" data-path = "../appendix/tricks.html" >
< a href = "../appendix/tricks.html" >
< b > 9.5.< / b >
使用技巧
< / a >
< / li >
< li class = "chapter " data-level = "9.6" data-path = "../appendix/issues.html" >
< a href = "../appendix/issues.html" >
< b > 9.6.< / b >
问题记录
< / a >
< / li >
< li class = "chapter " data-level = "9.7" data-path = "../appendix/kubernetes-changelog.html" >
< a href = "../appendix/kubernetes-changelog.html" >
< b > 9.7.< / b >
Kubernetes 版本更新日志
< / a >
< ul class = "articles" >
< li class = "chapter " data-level = "9.7.1" data-path = "../appendix/kubernetes-1.7-changelog.html" >
< a href = "../appendix/kubernetes-1.7-changelog.html" >
< b > 9.7.1.< / b >
Kubernetes1.7 更新日志
< / a >
< / li >
< li class = "chapter " data-level = "9.7.2" data-path = "../appendix/kubernetes-1.8-changelog.html" >
< a href = "../appendix/kubernetes-1.8-changelog.html" >
< b > 9.7.2.< / b >
Kubernetes1.8 更新日志
< / a >
< / li >
< li class = "chapter " data-level = "9.7.3" data-path = "../appendix/kubernetes-1.9-changelog.html" >
< a href = "../appendix/kubernetes-1.9-changelog.html" >
< b > 9.7.3.< / b >
Kubernetes1.9 更新日志
< / a >
< / li >
< li class = "chapter " data-level = "9.7.4" data-path = "../appendix/kubernetes-1.10-changelog.html" >
< a href = "../appendix/kubernetes-1.10-changelog.html" >
< b > 9.7.4.< / b >
Kubernetes1.10 更新日志
< / a >
< / li >
< li class = "chapter " data-level = "9.7.5" data-path = "../appendix/kubernetes-1.11-changelog.html" >
< a href = "../appendix/kubernetes-1.11-changelog.html" >
< b > 9.7.5.< / b >
Kubernetes1.11 更新日志
< / a >
< / li >
< li class = "chapter " data-level = "9.7.6" data-path = "../appendix/kubernetes-1.12-changelog.html" >
< a href = "../appendix/kubernetes-1.12-changelog.html" >
< b > 9.7.6.< / b >
Kubernetes1.12 更新日志
< / a >
< / li >
< li class = "chapter " data-level = "9.7.7" data-path = "../appendix/kubernetes-1.13-changelog.html" >
< a href = "../appendix/kubernetes-1.13-changelog.html" >
< b > 9.7.7.< / b >
Kubernetes1.13 更新日志
< / a >
< / li >
< li class = "chapter " data-level = "9.7.8" data-path = "../appendix/kubernetes-1.14-changelog.html" >
< a href = "../appendix/kubernetes-1.14-changelog.html" >
< b > 9.7.8.< / b >
Kubernetes1.14 更新日志
< / a >
< / li >
< li class = "chapter " data-level = "9.7.9" data-path = "../appendix/kubernetes-1.15-changelog.html" >
< a href = "../appendix/kubernetes-1.15-changelog.html" >
< b > 9.7.9.< / b >
Kubernetes1.15 更新日志
< / a >
< / li >
< / ul >
< / li >
< li class = "chapter " data-level = "9.8" data-path = "../appendix/summary-and-outlook.html" >
< a href = "../appendix/summary-and-outlook.html" >
< b > 9.8.< / b >
Kubernetes 及云原生年度总结及展望
< / a >
< ul class = "articles" >
< li class = "chapter " data-level = "9.8.1" data-path = "../appendix/kubernetes-and-cloud-native-summary-in-2017-and-outlook-for-2018.html" >
< a href = "../appendix/kubernetes-and-cloud-native-summary-in-2017-and-outlook-for-2018.html" >
< b > 9.8.1.< / b >
Kubernetes 与云原生 2017 年年终总结及 2018 年展望
< / a >
< / li >
< li class = "chapter " data-level = "9.8.2" data-path = "../appendix/kubernetes-and-cloud-native-summary-in-2018-and-outlook-for-2019.html" >
< a href = "../appendix/kubernetes-and-cloud-native-summary-in-2018-and-outlook-for-2019.html" >
< b > 9.8.2.< / b >
Kubernetes 与云原生 2018 年年终总结及 2019 年展望
< / a >
< / li >
< / ul >
< / li >
< li class = "chapter " data-level = "9.9" data-path = "../appendix/cncf-annual-report.html" >
< a href = "../appendix/cncf-annual-report.html" >
< b > 9.9.< / b >
CNCF 年度报告解读
< / a >
< ul class = "articles" >
< li class = "chapter " data-level = "9.9.1" data-path = "../appendix/cncf-annual-report-2018.html" >
< a href = "../appendix/cncf-annual-report-2018.html" >
< b > 9.9.1.< / b >
CNCF 2018 年年度报告解读
< / a >
< / li >
< / ul >
< / li >
< li class = "chapter " data-level = "9.10" data-path = "../appendix/about-kcsp.html" >
< a href = "../appendix/about-kcsp.html" >
< b > 9.10.< / b >
Kubernetes 认证服务提供商( KCSP) 说明
< / a >
< / li >
< li class = "chapter " data-level = "9.11" data-path = "../appendix/about-cka-candidate.html" >
< a href = "../appendix/about-cka-candidate.html" >
< b > 9.11.< / b >
认证 Kubernetes 管理员( CKA) 说明
< / a >
< / li >
< li class = "divider" > < / li >
< li >
< a href = "https://www.gitbook.com" target = "blank" class = "gitbook-link" >
本书使用 GitBook 发布
< / a >
< / li >
< / ul >
< / nav >
< / div >
< div class = "book-body" >
< div class = "body-inner" >
< div class = "book-header" role = "navigation" >
<!-- Title -->
< h1 >
< i class = "fa fa-circle-o-notch fa-spin" > < / i >
< a href = ".." > Kubernetes 中的用户与身份认证授权< / a >
< / h1 >
< / div >
< div class = "page-wrapper" tabindex = "-1" role = "main" >
< div class = "page-inner" >
< div class = "search-plus" id = "book-search-results" >
< div class = "search-noresults" >
< section class = "normal markdown-section" >
< h1 id = "kubernetes-中的用户与身份认证授权" > Kubernetes 中 的 用 户 与 身 份 认 证 授 权 < / h1 >
< p > 在 安 装 集 群 的 时 候 我 们 在 master 节 点 上 生 成 了 一 堆 证 书 、 token, 还 在 kubelet 的 配 置 中 用 到 了 bootstrap token, 安 装 各 种 应 用 时 , 为 了 能 够 与 API server 通 信 创 建 了 各 种 service account, 在 Dashboard 中 使 用 了 kubeconfig 或 token 登 陆 , 那 么 这 些 都 属 于 什 么 认 证 方 式 ? 如 何 区 分 用 户 的 ? 我 特 地 翻 译 了 下 这 篇 官 方 文 档 , 想 你 看 了 之 后 你 将 找 到 答 案 。 < / p >
< p > 重 点 查 看 bearer token 和 HTTP 认 证 中 的 token 使 用 , 我 们 已 经 有 所 应 用 , 如 < a href = "auth-with-kubeconfig-or-token.html" > 使 用 kubeconfig或 token进 行 用 户 身 份 认 证 < / a > 。 < / p >
< h2 id = "认识-kubernetes-中的用户" > 认 识 Kubernetes 中 的 用 户 < / h2 >
< p > Kubernetes 集 群 中 包 含 两 类 用 户 : 一 类 是 由 Kubernetes 管 理 的 service account, 另 一 类 是 普 通 用 户 。 < / p >
< p > 普 通 用 户 被 假 定 为 由 外 部 独 立 服 务 管 理 。 管 理 员 分 发 私 钥 , 用 户 存 储 ( 如 Keystone 或 Google 帐 户 ) , 甚 至 包 含 用 户 名 和 密 码 列 表 的 文 件 。 在 这 方 面 , < em > Kubernetes 没 有 代 表 普 通 用 户 帐 户 的 对 象 < / em > 。 无 法 通 过 API 调 用 的 方 式 向 集 群 中 添 加 普 通 用 户 。 < / p >
< p > 相 对 的 , service account 是 由 Kubernetes API 管 理 的 帐 户 。 它 们 都 绑 定 到 了 特 定 的 namespace, 并 由 API server 自 动 创 建 , 或 者 通 过 API 调 用 手 动 创 建 。 Service account 关 联 了 一 套 凭 证 , 存 储 在 < code > Secret< / code > , 这 些 凭 证 同 时 被 挂 载 到 pod 中 , 从 而 允 许 pod 与 kubernetes API 之 间 的 调 用 。 < / p >
< p > API 请 求 被 绑 定 到 普 通 用 户 或 serivce account 上 , 或 者 作 为 匿 名 请 求 对 待 。 这 意 味 着 集 群 内 部 或 外 部 的 每 个 进 程 , 无 论 从 在 工 作 站 上 输 入 < code > kubectl< / code > 的 人 类 用 户 到 节 点 上 的 < code > kubelet< / code > , 到 控 制 平 面 的 成 员 , 都 必 须 在 向 API Server 发 出 请 求 时 进 行 身 份 验 证 , 或 者 被 视 为 匿 名 用 户 。 < / p >
< h2 id = "认证策略" > 认 证 策 略 < / h2 >
< p > Kubernetes 使 用 客 户 端 证 书 、 bearer token、 身 份 验 证 代 理 或 者 HTTP 基 本 身 份 验 证 等 身 份 认 证 插 件 来 对 API 请 求 进 行 身 份 验 证 。 当 有 HTTP 请 求 发 送 到 API server 时 , 插 件 会 尝 试 将 以 下 属 性 关 联 到 请 求 上 : < / p >
< ul >
< li > 用 户 名 : 标 识 最 终 用 户 的 字 符 串 。 常 用 值 可 能 是 < code > kube-admin< / code > 或 < code > jane@example.com< / code > 。 < / li >
< li > UID: 标 识 最 终 用 户 的 字 符 串 , 比 用 户 名 更 加 一 致 且 唯 一 。 < / li >
< li > 组 : 一 组 将 用 户 和 常 规 用 户 组 相 关 联 的 字 符 串 。 < / li >
< li > 额 外 字 段 : 包 含 其 他 有 用 认 证 信 息 的 字 符 串 列 表 的 映 射 。 < / li >
< / ul >
< p > 所 有 的 值 对 于 认 证 系 统 都 是 不 透 明 的 , 只 有 < a href = "https://kubernetes.io/docs/admin/authorization/" target = "_blank" > 授 权 人 < / a > 才 能 解 释 这 些 值 的 重 要 含 义 。 < / p >
< p > 您 可 以 一 次 性 启 用 多 种 身 份 验 证 方 式 。 通 常 使 用 至 少 以 下 两 种 认 证 方 式 : < / p >
< ul >
< li > 服 务 帐 户 的 service account token< / li >
< li > 至 少 一 种 其 他 的 用 户 认 证 的 方 式 < / li >
< / ul >
< p > 当 启 用 了 多 个 认 证 模 块 时 , 第 一 个 认 证 模 块 成 功 认 证 后 将 短 路 请 求 , 不 会 进 行 第 二 个 模 块 的 认 证 。 API server 不 会 保 证 认 证 的 顺 序 。 < / p >
< p > < code > system:authenticated< / code > 组 包 含 在 所 有 已 验 证 用 户 的 组 列 表 中 。 < / p >
< p > 与 其 他 身 份 验 证 协 议 ( LDAP、 SAML、 Kerberos、 x509 方 案 等 ) 的 集 成 可 以 使 用 身 份 验 证 代 理 或 身 份 验 证 webhook来 实 现 。 < / p >
< h3 id = "x509-客户端证书" > X509 客 户 端 证 书 < / h3 >
< p > 通 过 将 < code > --client-ca-file=SOMEFILE< / code > 选 项 传 递 给 API server 来 启 用 客 户 端 证 书 认 证 。 引 用 的 文 件 必 须 包 含 一 个 或 多 个 证 书 颁 发 机 构 , 用 于 验 证 提 交 给 API server 的 客 户 端 证 书 。 如 果 客 户 端 证 书 已 提 交 并 验 证 , 则 使 用 subject 的 Common Name( CN) 作 为 请 求 的 用 户 名 。 从 Kubernetes 1.4开 始 , 客 户 端 证 书 还 可 以 使 用 证 书 的 organization 字 段 来 指 示 用 户 的 组 成 员 身 份 。 要 为 用 户 包 含 多 个 组 成 员 身 份 , 请 在 证 书 中 包 含 多 个 organization 字 段 。 < / p >
< p > 例 如 , 使 用 < code > openssl< / code > 命 令 工 具 生 成 用 于 签 名 认 证 请 求 的 证 书 : < / p >
< pre class = "language-" > < code class = "lang-bash" > openssl req -new -key jbeda.pem -out jbeda-csr.pem -subj < span class = "token string" > " /CN=jbeda/O=app1/O=app2" < / span >
< / code > < / pre >
< p > 这 将 为 一 个 用 户 名 为 ” jbeda“ 的 CSR, 属 于 两 个 组 “ app1” 和 “ app2” 。 < / p >
< h3 id = "静态-token-文件" > 静 态 Token 文 件 < / h3 >
< p > 当 在 命 令 行 上 指 定 < code > --token-auth-file=SOMEFILE< / code > 选 项 时 , API server 从 文 件 读 取 bearer token。 目 前 , token 会 无 限 期 地 持 续 下 去 , 并 且 不 重 新 启 动 API server 的 话 就 无 法 更 改 令 牌 列 表 。 < / p >
< p > token 文 件 是 一 个 csv 文 件 , 每 行 至 少 包 含 三 列 : token、 用 户 名 、 用 户 uid, 其 次 是 可 选 的 组 名 。 请 注 意 , 如 果 您 有 多 个 组 , 则 该 列 必 须 使 用 双 引 号 。 < / p >
< pre class = "language-" > < code class = "lang-ini" > token,user,uid," group1,group2,group3"
< / code > < / pre >
< h4 id = "在请求中放置-bearer-token" > 在 请 求 中 放 置 Bearer Token< / h4 >
< p > 当 使 用 来 自 http 客 户 端 的 bearer token 时 , API server 期 望 < code > Authorization< / code > header 中 包 含 < code > Bearer token< / code > 的 值 。 Bearer token 必 须 是 一 个 字 符 串 序 列 , 只 需 使 用 HTTP 的 编 码 和 引 用 功 能 就 可 以 将 其 放 入 到 HTTP header 中 。 例 如 : 如 果 bearer token 是 < code > 31ada4fd-adec-460c-809a-9e56ceb75269< / code > , 那 么 它 将 出 现 在 HTTP header 中 , 如 下 所 示 : < / p >
< pre class = "language-" > < code class = "lang-http" > < span class = "token header-name keyword" > Authorization:< / span > Bearer 31ada4fd-adec-460c-809a-9e56ceb75269
< / code > < / pre >
< h3 id = "bootstrap-token" > Bootstrap Token< / h3 >
< p > 该 功 能 仍 处 于 < strong > alpha< / strong > 版 本 。 < / p >
< p > 为 了 简 化 新 集 群 的 初 始 化 引 导 过 程 , Kubernetes 中 包 含 了 一 个 名 为 < em > Bootstrap Token< / em > 的 动 态 管 理 的 bearer token。 这 些 token 使 用 Secret 存 储 在 < code > kube-system< / code > namespace 中 , 在 那 里 它 们 可 以 被 动 态 管 理 和 创 建 。 Controller Manager 中 包 含 了 一 个 TokenCleaner 控 制 器 , 用 于 在 bootstrap token 过 期 时 删 除 将 其 删 除 。 < / p >
< p > 这 些 token 的 形 式 是 < code > [a-z0-9]{6}.[a-z0-9]{16}< / code > 。 第 一 部 分 是 Token ID, 第 二 部 分 是 Token Secret。 您 在 HTTP header 中 指 定 的 token 如 下 所 示 : < / p >
< pre class = "language-" > < code class = "lang-http" > < span class = "token header-name keyword" > Authorization:< / span > Bearer 781292.db7bc3a58fc5f07e
< / code > < / pre >
< p > 在 API server 的 启 动 参 数 中 加 上 < code > --experimental-bootstrap-token-auth< / code > 标 志 以 启 用 Bootstrap Token Authenticator。 您 必 须 通 过 Controller Manager 上 的 < code > --controllers< / code > 标 志 启 用 TokenCleaner 控 制 器 , 如 < code > --controllers=*,tokencleaner< / code > 。 如 果 您 使 用 它 来 引 导 集 群 , < code > kubeadm< / code > 会 为 您 完 成 。 < / p >
< p > 认 证 者 认 证 为 < code > system:bootstrap:< span class = "token tag" > < span class = "token tag" > < span class = "token punctuation" > < < / span > Token< / span > < span class = "token attr-name" > ID< / span > < span class = "token punctuation" > > < / span > < / span > < / code > 。 被 包 含 在 < code > system:bootstrappers< / code > 组 中 。 命 名 和 组 是 有 意 限 制 用 户 使 用 过 去 的 bootstap token。 可 以 使 用 用 户 名 和 组 ( < code > kubeadm< / code > 使 用 ) 来 制 定 适 当 的 授 权 策 略 以 支 持 引 导 集 群 。 < / p >
< p > 有 关 Bootstrap Token 身 份 验 证 器 和 控 制 器 的 更 深 入 的 文 档 , 以 及 如 何 使 用 < code > kubeadm< / code > 管 理 这 些 令 牌 , 请 参 阅 < a href = "https://kubernetes.io/docs/admin/bootstrap-tokens/" target = "_blank" > Bootstrap Token< / a > 。 < / p >
< h3 id = "静态密码文件" > 静 态 密 码 文 件 < / h3 >
< p > 通 过 将 < code > --basic-auth-file=SOMEFILE< / code > 选 项 传 递 给 API server 来 启 用 基 本 身 份 验 证 。 目 前 , 基 本 身 份 验 证 凭 证 将 无 限 期 地 保 留 , 并 且 密 码 在 不 重 新 启 动 API服 务 器 的 情 况 下 无 法 更 改 。 请 注 意 , 为 了 方 便 起 见 , 目 前 支 持 基 本 身 份 验 证 , 而 上 述 模 式 更 安 全 更 容 易 使 用 。 < / p >
< p > 基 本 身 份 认 证 是 一 个 csv 文 件 , 至 少 包 含 3列 : 密 码 、 用 户 名 和 用 户 ID。 在 Kubernetes 1.6 和 更 高 版 本 中 , 可 以 指 定 包 含 以 逗 号 分 隔 的 组 名 称 的 可 选 第 四 列 。 如 果 您 有 多 个 组 , 则 必 须 将 第 四 列 值 用 双 引 号 ( “ ) 括 起 来 , 请 参 阅 以 下 示 例 : < / p >
< pre class = "language-" > < code class = "lang-ini" > password,user,uid," group1,group2,group3"
< / code > < / pre >
< p > 当 使 用 来 自 HTTP 客 户 端 的 基 本 身 份 验 证 时 , API server 需 要 < code > Authorization< / code > header 中 包 含 < code > Basic BASE64ENCODED(USER:PASSWORD)< / code > 的 值 。 < / p >
< h3 id = "service-account-token" > Service Account Token< / h3 >
< p > Service account 是 一 个 自 动 启 用 的 验 证 器 , 它 使 用 签 名 的 bearer token 来 验 证 请 求 。 该 插 件 包 括 两 个 可 选 的 标 志 : < / p >
< ul >
< li > < code > --service-account-key-file< / code > 一 个 包 含 签 名 bearer token 的 PEM 编 码 文 件 。 如 果 未 指 定 , 将 使 用 API server 的 TLS 私 钥 。 < / li >
< li > < code > --service-account-lookup< / code > 如 果 启 用 , 从 API 中 删 除 掉 的 token 将 被 撤 销 。 < / li >
< / ul >
< p > Service account 通 常 API server 自 动 创 建 , 并 通 过 < code > ServiceAccount< / code > < a href = "https://kubernetes.io/docs/admin/admission-controllers/" target = "_blank" > 注 入 控 制 器 < / a > 关 联 到 集 群 中 运 行 的 Pod 上 。 Bearer token 挂 载 到 pod 中 众 所 周 知 的 位 置 , 并 允 许 集 群 进 程 与 API server 通 信 。 帐 户 可 以 使 用 < code > PodSpec< / code > 的 < code > serviceAccountName< / code > 字 段 显 式 地 与 Pod关 联 。 < / p >
< p > 注 意 : < code > serviceAccountName< / code > 通 常 被 省 略 , 因 为 这 会 自 动 生 成 。 < / p >
< pre class = "language-" > < code class = "lang-yaml" > < span class = "token key atrule" > apiVersion< / span > < span class = "token punctuation" > :< / span > apps/v1beta2
< span class = "token key atrule" > kind< / span > < span class = "token punctuation" > :< / span > Deployment
< span class = "token key atrule" > metadata< / span > < span class = "token punctuation" > :< / span >
< span class = "token key atrule" > name< / span > < span class = "token punctuation" > :< / span > nginx< span class = "token punctuation" > -< / span > deployment
< span class = "token key atrule" > namespace< / span > < span class = "token punctuation" > :< / span > default
< span class = "token key atrule" > spec< / span > < span class = "token punctuation" > :< / span >
< span class = "token key atrule" > replicas< / span > < span class = "token punctuation" > :< / span > < span class = "token number" > 3< / span >
< span class = "token key atrule" > template< / span > < span class = "token punctuation" > :< / span >
< span class = "token key atrule" > metadata< / span > < span class = "token punctuation" > :< / span >
< span class = "token comment" > # ...< / span >
< span class = "token key atrule" > spec< / span > < span class = "token punctuation" > :< / span >
< span class = "token key atrule" > containers< / span > < span class = "token punctuation" > :< / span >
< span class = "token punctuation" > -< / span > < span class = "token key atrule" > name< / span > < span class = "token punctuation" > :< / span > nginx
< span class = "token key atrule" > image< / span > < span class = "token punctuation" > :< / span > nginx< span class = "token punctuation" > :< / span > 1.7.9
< span class = "token key atrule" > serviceAccountName< / span > < span class = "token punctuation" > :< / span > bob< span class = "token punctuation" > -< / span > the< span class = "token punctuation" > -< / span > bot
< / code > < / pre >
< p > Service account bearer token 在 集 群 外 使 用 也 是 完 全 有 效 的 , 并 且 可 以 用 于 为 希 望 与 Kubernetes 通 信 的 长 期 运 行 作 业 创 建 身 份 。 要 手 动 创 建 service account, 只 需 要 使 用 < code > kubectl create serviceaccount (NAME)< / code > 命 令 。 这 将 在 当 前 的 namespace 和 相 关 连 的 secret 中 创 建 一 个 service account。 < / p >
< pre class = "language-" > < code class = "lang-bash" > $ kubectl create serviceaccount jenkins
serviceaccount < span class = "token string" > " jenkins" < / span > created
$ kubectl get serviceaccounts jenkins -o yaml
apiVersion: v1
kind: ServiceAccount
metadata:
< span class = "token comment" > # ...< / span >
secrets:
- name: jenkins-token-1yvwg
< / code > < / pre >
< p > 创 建 出 的 secret 中 拥 有 API server 的 公 共 CA 和 前 面 的 JSON Web Token( JWT) 。 < / p >
< pre class = "language-" > < code class = "lang-bash" > $ kubectl get secret jenkins-token-1yvwg -o yaml
apiVersion: v1
data:
ca.crt: < span class = "token punctuation" > (< / span > APISERVER' S CA BASE64 ENCODED< span class = "token punctuation" > )< / span >
namespace: < span class = "token assign-left variable" > ZGVmYXVsdA< / span > < span class = "token operator" > ==< / span >
token: < span class = "token punctuation" > (< / span > BEARER TOKEN BASE64 ENCODED< span class = "token punctuation" > )< / span >
kind: Secret
metadata:
< span class = "token comment" > # ...< / span >
type: kubernetes.io/service-account-token
< / code > < / pre >
< p > 注 意 : 所 有 值 是 基 于 base64 编 码 的 , 因 为 secret 总 是 基 于 base64 编 码 。 < / p >
< p > 经 过 签 名 的 JWT 可 以 用 作 bearer token 与 给 定 的 service account 进 行 身 份 验 证 。 请 参 阅 上 面 关 于 如 何 在 请 求 中 放 置 bearer token。 通 常 情 况 下 , 这 些 secret 被 挂 载 到 pod 中 , 以 便 对 集 群 内 的 API server 进 行 访 问 , 但 也 可 以 从 集 群 外 访 问 。 < / p >
< p > Service account 验 证 时 用 户 名 < code > system:serviceaccount:(NAMESPACE):(SERVICEACCOUNT)< / code > , 被 指 定 到 组 < code > system:serviceaccounts< / code > 和 < code > system:serviceaccounts:(NAMESPACE)< / code > 。 < / p >
< p > 注 意 : 由 于 service account 的 token 存 储 在 secret 中 , 所 以 具 有 对 这 些 secret 的 读 取 权 限 的 任 何 用 户 都 可 以 作 为 service account 进 行 身 份 验 证 。 授 予 service account 权 限 和 读 取 secret 功 能 时 要 谨 慎 。 < / p >
< h3 id = "openid-connect-token" > OpenID Connect Token< / h3 >
< p > < a href = "https://openid.net/connect/" target = "_blank" > OpenID Connect< / a > 是 由 OAuth2 供 应 商 提 供 的 OAuth2, 特 别 是 Azure Active Directory、 Salesforce 和 Google。 对 OAuth2 协 议 的 主 要 扩 展 是 返 回 一 个 称 作 < a href = "https://openid.net/specs/openid-connect-core-1_0.html#IDToken" target = "_blank" > ID Token< / a > 的 格 外 字 段 。 该 token 是 一 个 JSON Web Token (JWT) , 有 服 务 器 签 名 , 具 有 众 所 周 知 的 字 段 , 如 用 户 的 电 子 邮 件 。 < / p >
< p > 为 了 识 别 用 户 , 认 证 者 使 用 OAuth2 < a href = "https://openid.net/specs/openid-connect-core-1_0.html#TokenResponse" target = "_blank" > token 响 应 < / a > 中 的 < code > id_token< / code > ( 而 不 是 < code > access_token< / code > ) 作 为 bearer token。 请 参 阅 上 面 的 关 于 将 token 置 于 请 求 中 。 < / p >
2020-06-24 15:34:21 +08:00
< figure id = "fig4.4.7.1" > < a href = "../images/kubernetes-oidc-login.jpg" data-lightbox = "6a15183d-d8a4-4173-899e-29d22eb12946" data-title = "Kubernetes OpenID Connect Flow" > < img src = "../images/kubernetes-oidc-login.jpg" alt = "Kubernetes OpenID Connect Flow" > < / a > < figcaption > 图 4.4.7.1: Kubernetes OpenID Connect Flow< / figcaption > < / figure >
2020-06-19 14:52:56 +08:00
< ol >
< li > 登 陆 到 您 的 身 份 提 供 商 < / li >
< li > 您 的 身 份 提 供 商 将 为 您 提 供 一 个 < code > access_token< / code > , 一 个 < code > id_token< / code > 和 一 个 < code > refresh_token< / code > < / li >
< li > 当 使 用 < code > kubectl< / code > 时 , 使 用 < code > --token< / code > 标 志 和 < code > id_token< / code > , 或 者 直 接 加 入 到 您 的 < code > kubeconfig< / code > 文 件 中 < / li >
< li > < code > kubectl< / code > 在 调 用 API server 时 将 < code > id_token< / code > 置 于 HTTP header 中 < / li >
< li > API server 将 通 过 检 查 配 置 中 指 定 的 证 书 来 确 保 JWT 签 名 有 效 < / li >
< li > 检 查 以 确 保 < code > id_token< / code > 没 有 过 期 < / li >
< li > 确 保 用 户 已 授 权 < / li >
< li > 授 权 API server 后 向 < code > kubectl< / code > < / li >
< li > < code > kubectl< / code > 向 用 户 提 供 反 馈 < / li >
< / ol >
< p > 由 于 所 有 需 要 验 证 您 身 份 的 数 据 都 在 < code > id_token< / code > 中 , Kubernetes 不 需 要 向 身 份 提 供 商 “ phone home” 。 在 每 个 请 求 都 是 无 状 态 的 模 型 中 , 这 为 认 证 提 供 了 非 常 可 扩 展 的 解 决 方 案 。 它 确 实 提 供 了 一 些 挑 战 : < / p >
< ol >
< li > Kubernetes 没 有 ” web 接 口 “ 来 出 发 验 证 进 程 。 没 有 浏 览 器 或 界 面 来 收 集 凭 据 , 这 就 是 为 什 么 您 需 要 首 先 认 证 您 的 身 份 提 供 商 。 < / li >
< li > < code > id_token< / code > 无 法 撤 销 , 就 像 一 个 证 书 , 所 以 它 应 该 是 短 暂 的 ( 只 有 几 分 钟 ) , 所 以 每 隔 几 分 钟 就 得 到 一 个 新 的 令 牌 是 非 常 烦 人 的 。 < / li >
< li > 没 有 使 用 < code > kubectl proxy< / code > 命 令 或 注 入 < code > id_token< / code > 的 反 向 代 理 , 无 法 简 单 地 对 Kubernetes dashboard 进 行 身 份 验 证 。 < / li >
< / ol >
< h4 id = "配置-api-server" > 配 置 API Server< / h4 >
< p > 要 启 用 该 插 件 , 需 要 在 API server 中 配 置 如 下 标 志 : < / p >
< table >
< thead >
< tr >
< th > 参 数 < / th >
< th > 描 述 < / th >
< th > 示 例 < / th >
< th > 是 否 必 需 < / th >
< / tr >
< / thead >
< tbody >
< tr >
< td > < code > --oidc-issuer-url< / code > < / td >
< td > 允 许 API server 发 现 公 共 签 名 密 钥 的 提 供 者 的 URL。 只 接 受 使 用 < code > https://< / code > 的 方 案 。 通 常 是 提 供 商 的 URL 地 址 , 不 包 含 路 径 , 例 如 “ < a href = "https://accounts.google.com" target = "_blank" > https://accounts.google.com< / a > ” 或 者 “ < a href = "https://login.salesforce.com" target = "_blank" > https://login.salesforce.com< / a > ” 。 这 个 URL 应 该 指 向 下 面 的 .well-known/openid-configuration< / td >
< td > 如 果 发 现 URL 是 < code > https://accounts.google.com/.well-known/openid-configuration< / code > , 值 应 该 是 < code > https://accounts.google.com< / code > < / td >
< td > 是 < / td >
< / tr >
< tr >
< td > < code > --oidc-client-id< / code > < / td >
< td > 所 有 的 token 必 须 为 其 颁 发 的 客 户 端 ID< / td >
< td > kubernetes< / td >
< td > 是 < / td >
< / tr >
< tr >
< td > < code > --oidc-username-claim< / code > < / td >
< td > JWT声 明 使 用 的 用 户 名 。 默 认 情 况 下 , < code > sub< / code > 是 最 终 用 户 的 唯 一 标 识 符 。 管 理 员 可 以 选 择 其 他 声 明 , 如 < code > email< / code > 或 < code > name< / code > , 具 体 取 决 于 他 们 的 提 供 者 。 不 过 , < code > email< / code > 以 外 的 其 他 声 明 将 以 发 行 者 的 URL 作 为 前 缀 , 以 防 止 与 其 他 插 件 命 名 冲 突 。 < / td >
< td > sub< / td >
< td > 否 < / td >
< / tr >
< tr >
< td > < code > --oidc-groups-claim< / code > < / td >
< td > JWT声 明 使 用 的 用 户 组 。 如 果 生 命 存 在 , 它 必 须 是 一 个 字 符 串 数 组 。 < / td >
< td > groups< / td >
< td > 否 < / td >
< / tr >
< tr >
< td > < code > --oidc-ca-file< / code > < / td >
< td > 用 来 签 名 您 的 身 份 提 供 商 的 网 络 CA 证 书 的 路 径 。 默 认 为 主 机 的 跟 CA。 < / td >
< td > < code > /etc/kubernetes/ssl/kc-ca.pem< / code > < / td >
< td > 否 < / td >
< / tr >
< / tbody >
< / table >
< p > 如 果 为 < code > --oidc-username-claim< / code > 选 择 了 除 < code > email< / code > 以 外 的 其 他 声 明 , 则 该 值 将 以 < code > --oidc-issuer-url< / code > 作 为 前 缀 , 以 防 止 与 现 有 Kubernetes 名 称 ( 例 如 < code > system:users< / code > ) 冲 突 。 例 如 , 如 果 提 供 商 网 址 是 < a href = "https://accounts.google.com,而用户名声明映射到" target = "_blank" > https://accounts.google.com, 而 用 户 名 声 明 映 射 到 < / a > < code > jane< / code > , 则 插 件 会 将 用 户 身 份 验 证 为 : < / p >
< pre class = "language-" > < code class = "lang-http" > < span class = "token header-name keyword" > https:< / span > //accounts.google.com#jane
< / code > < / pre >
< p > 重 要 的 是 , API server 不 是 OAuth2 客 户 端 , 而 只 能 配 置 为 信 任 单 个 发 行 者 。 这 允 许 使 用 Google 等 公 共 提 供 者 , 而 不 必 信 任 第 三 方 发 行 的 凭 据 。 希 望 利 用 多 个 OAuth 客 户 端 的 管 理 员 应 该 探 索 支 持 < code > azp< / code > ( 授 权 方 ) 声 明 的 提 供 者 , 这 是 允 许 一 个 客 户 端 代 表 另 一 个 客 户 端 发 放 令 牌 的 机 制 。 < / p >
< p > Kubernetes不 提 供 OpenID Connect 身 份 提 供 商 。 您 可 以 使 用 现 有 的 公 共 OpenID Connect 标 识 提 供 程 序 ( 例 如 Google 或 < a href = "http://connect2id.com/products/nimbus-oauth-openid-connect-sdk/openid-connect-providers" target = "_blank" > 其 他 < / a > ) 。 或 者 , 您 可 以 运 行 自 己 的 身 份 提 供 程 序 , 例 如 CoreOS < a href = "https://github.com/coreos/dex" target = "_blank" > dex< / a > 、 < a href = "https://github.com/keycloak/keycloak" target = "_blank" > Keycloak< / a > 、 CloudFoundry < a href = "https://github.com/cloudfoundry/uaa" target = "_blank" > UAA< / a > 或 Tremolo Security 的 < a href = "https://github.com/tremolosecurity/openunison" target = "_blank" > OpenUnison< / a > 。 < / p >
< p > 对 于 身 份 提 供 商 能 够 适 用 于 Kubernetes, 必 须 满 足 如 下 条 件 : Kubernetes it must:< / p >
< ol >
< li > 支 持 < a href = "https://openid.net/specs/openid-connect-discovery-1_0.html" target = "_blank" > OpenID connect 发 现 < / a > ; 不 必 是 全 部 。 < / li >
< li > 使 用 非 过 时 密 码 在 TLS中 运 行 < / li >
< li > 拥 有 CA 签 名 证 书 ( 即 使 CA 不 是 商 业 CA 或 自 签 名 ) < / li >
< / ol >
< p > 有 关 上 述 要 求 3的 说 明 , 需 要 CA 签 名 证 书 。 如 果 您 部 署 自 己 的 身 份 提 供 商 ( 而 不 是 像 Google 或 Microsoft 之 类 的 云 提 供 商 ) , 则 必 须 让 您 的 身 份 提 供 商 的 Web 服 务 器 证 书 由 CA 标 志 设 置 为 TRUE 的 证 书 签 名 , 即 使 是 自 签 名 的 。 这 是 由 于 GoLang 的 TLS 客 户 端 实 现 对 证 书 验 证 的 标 准 非 常 严 格 。 如 果 您 没 有 < code > CA< / code > , 可 以 使 用 < code > CoreOS< / code > 团 队 的 < a href = "https://github.com/coreos/dex/blob/1ee5920c54f5926d6468d2607c728b71cfe98092/examples/k8s/gencert.sh" target = "_blank" > 这 个 脚 本 < / a > 创 建 一 个 简 单 的 CA 和 一 个 签 名 的 证 书 和 密 钥 对 。 < / p >
< p > 针 对 特 定 系 统 的 安 装 说 明 : < / p >
< ul >
< li > < a href = "https://apigee.com/about/blog/engineering/kubernetes-authentication-enterprise" target = "_blank" > UAA< / a > < / li >
< li > < a href = "https://speakerdeck.com/ericchiang/kubernetes-access-control-with-dex" target = "_blank" > Dex< / a > < / li >
< li > < a href = "https://github.com/TremoloSecurity/openunison-qs-kubernetes" target = "_blank" > OpenUnison< / a > < / li >
< / ul >
< h4 id = "使用-kubectl" > 使 用 kubectl< / h4 >
< h5 id = "选项-1---oidc-身份验证器" > 选 项 1 - OIDC 身 份 验 证 器 < / h5 >
< p > 第 一 个 选 项 是 使 用 < code > oidc< / code > 身 份 验 证 器 。 此 身 份 验 证 程 序 将 您 的 < code > id_token< / code > 、 < code > refresh_token< / code > 和 您 的 OIDC < code > client_secret< / code > 自 动 刷 新 您 的 token。 一 旦 您 对 身 份 提 供 者 进 行 了 身 份 验 证 : < / p >
< pre class = "language-" > < code class = "lang-bash" > kubectl config set-credentials USER_NAME < span class = "token punctuation" > \< / span >
--auth-provider< span class = "token operator" > =< / span > oidc < span class = "token punctuation" > \< / span >
--auth-provider-arg< span class = "token operator" > =< / span > idp-issuer-url< span class = "token operator" > =< / span > < span class = "token punctuation" > (< / span > issuer url < span class = "token punctuation" > )< / span > < span class = "token punctuation" > \< / span >
--auth-provider-arg< span class = "token operator" > =< / span > client-id< span class = "token operator" > =< / span > < span class = "token punctuation" > (< / span > your client < span class = "token function" > id< / span > < span class = "token punctuation" > )< / span > < span class = "token punctuation" > \< / span >
--auth-provider-arg< span class = "token operator" > =< / span > client-secret< span class = "token operator" > =< / span > < span class = "token punctuation" > (< / span > your client secret < span class = "token punctuation" > )< / span > < span class = "token punctuation" > \< / span >
--auth-provider-arg< span class = "token operator" > =< / span > refresh-token< span class = "token operator" > =< / span > < span class = "token punctuation" > (< / span > your refresh token < span class = "token punctuation" > )< / span > < span class = "token punctuation" > \< / span >
--auth-provider-arg< span class = "token operator" > =< / span > idp-certificate-authority< span class = "token operator" > =< / span > < span class = "token punctuation" > (< / span > path to your ca certificate < span class = "token punctuation" > )< / span > < span class = "token punctuation" > \< / span >
--auth-provider-arg< span class = "token operator" > =< / span > id-token< span class = "token operator" > =< / span > < span class = "token punctuation" > (< / span > your id_token < span class = "token punctuation" > )< / span > < span class = "token punctuation" > \< / span >
--auth-provider-arg< span class = "token operator" > =< / span > extra-scopes< span class = "token operator" > =< / span > < span class = "token punctuation" > (< / span > comma separated list of scopes to < span class = "token function" > add< / span > to < span class = "token string" > " openid email profile" < / span > , optional < span class = "token punctuation" > )< / span >
< / code > < / pre >
< p > 例 如 , 在 向 身 份 提 供 者 进 行 身 份 验 证 之 后 运 行 以 下 命 令 : < / p >
< pre class = "language-" > < code class = "lang-bash" > kubectl config set-credentials mmosley < span class = "token punctuation" > \< / span >
--auth-provider< span class = "token operator" > =< / span > oidc < span class = "token punctuation" > \< / span >
--auth-provider-arg< span class = "token operator" > =< / span > idp-issuer-url< span class = "token operator" > =< / span > https://oidcidp.tremolo.lan:8443/auth/idp/OidcIdP < span class = "token punctuation" > \< / span >
--auth-provider-arg< span class = "token operator" > =< / span > client-id< span class = "token operator" > =< / span > kubernetes < span class = "token punctuation" > \< / span >
--auth-provider-arg< span class = "token operator" > =< / span > client-secret< span class = "token operator" > =< / span > 1db158f6-177d-4d9c-8a8b-d36869918ec5 < span class = "token punctuation" > \< / span >
--auth-provider-arg< span class = "token operator" > =< / span > refresh-token< span class = "token operator" > =< / span > q1bKLFOyUiosTfawzA93TzZIDzH2TNa2SMm0zEiPKTUwME6BkEo6Sql5yUWVBSWpKUGphaWpxSVAfekBOZbBhaEW+VlFUeVRGcluyVF5JT4+haZmPsluFoFu5XkpXk5BXqHega4GAXlF+ma+vmYpFcHe5eZR+slBFpZKtQA< span class = "token operator" > =< / span > < span class = "token punctuation" > \< / span >
--auth-provider-arg< span class = "token operator" > =< / span > idp-certificate-authority< span class = "token operator" > =< / span > /root/ca.pem < span class = "token punctuation" > \< / span >
--auth-provider-arg< span class = "token operator" > =< / span > extra-scopes< span class = "token operator" > =< / span > groups < span class = "token punctuation" > \< / span >
--auth-provider-arg< span class = "token operator" > =< / span > id-token< span class = "token operator" > =< / span > eyJraWQiOiJDTj1vaWRjaWRwLnRyZW1vbG8ubGFuLCBPVT1EZW1vLCBPPVRybWVvbG8gU2VjdXJpdHksIEw9QXJsaW5ndG9uLCBTVD1WaXJnaW5pYSwgQz1VUy1DTj1rdWJlLWNhLTEyMDIxNDc5MjEwMzYwNzMyMTUyIiwiYWxnIjoiUlMyNTYifQ.eyJpc3MiOiJodHRwczovL29pZGNpZHAudHJlbW9sby5sYW46ODQ0My9hdXRoL2lkcC9PaWRjSWRQIiwiYXVkIjoia3ViZXJuZXRlcyIsImV4cCI6MTQ4MzU0OTUxMSwianRpIjoiMm96US15TXdFcHV4WDlHZUhQdy1hZyIsImlhdCI6MTQ4MzU0OTQ1MSwibmJmIjoxNDgzNTQ5MzMxLCJzdWIiOiI0YWViMzdiYS1iNjQ1LTQ4ZmQtYWIzMC0xYTAxZWU0MWUyMTgifQ.w6p4J_6qQ1HzTG9nrEOrubxIMb9K5hzcMPxc9IxPx2K4xO9l-oFiUw93daH3m5pluP6K7eOE6txBuRVfEcpJSwlelsOsW8gb8VJcnzMS9EnZpeA0tW_p-mnkFc3VcfyXuhe5R3G7aa5d8uHv70yJ9Y3-UhjiN9EhpMdfPAoEB9fYKKkJRzF7utTTIPGrSaSU6d2pcpfYKaxIwePzEkT4DfcQthoZdy9ucNvvLoi1DIC-UocFD8HLs8LYKEqSxQvOcvnThbObJ9af71EwmuE21fO5KzMW20KtAeget1gnldOosPtz1G5EwvaQ401-RPQzPGMVBld0_zMCAwZttJ4knw
< / code > < / pre >
< p > 将 产 生 下 面 的 配 置 : < / p >
< pre class = "language-" > < code class = "lang-yaml" > < span class = "token key atrule" > users< / span > < span class = "token punctuation" > :< / span >
< span class = "token punctuation" > -< / span > < span class = "token key atrule" > name< / span > < span class = "token punctuation" > :< / span > mmosley
< span class = "token key atrule" > user< / span > < span class = "token punctuation" > :< / span >
< span class = "token key atrule" > auth-provider< / span > < span class = "token punctuation" > :< / span >
< span class = "token key atrule" > config< / span > < span class = "token punctuation" > :< / span >
< span class = "token key atrule" > client-id< / span > < span class = "token punctuation" > :< / span > kubernetes
< span class = "token key atrule" > client-secret< / span > < span class = "token punctuation" > :< / span > 1db158f6< span class = "token punctuation" > -< / span > 177d< span class = "token punctuation" > -< / span > 4d9c< span class = "token punctuation" > -< / span > 8a8b< span class = "token punctuation" > -< / span > d36869918ec5
< span class = "token key atrule" > extra-scopes< / span > < span class = "token punctuation" > :< / span > groups
< span class = "token key atrule" > id-token< / span > < span class = "token punctuation" > :< / span > eyJraWQiOiJDTj1vaWRjaWRwLnRyZW1vbG8ubGFuLCBPVT1EZW1vLCBPPVRybWVvbG8gU2VjdXJpdHksIEw9QXJsaW5ndG9uLCBTVD1WaXJnaW5pYSwgQz1VUy1DTj1rdWJlLWNhLTEyMDIxNDc5MjEwMzYwNzMyMTUyIiwiYWxnIjoiUlMyNTYifQ.eyJpc3MiOiJodHRwczovL29pZGNpZHAudHJlbW9sby5sYW46ODQ0My9hdXRoL2lkcC9PaWRjSWRQIiwiYXVkIjoia3ViZXJuZXRlcyIsImV4cCI6MTQ4MzU0OTUxMSwianRpIjoiMm96US15TXdFcHV4WDlHZUhQdy1hZyIsImlhdCI6MTQ4MzU0OTQ1MSwibmJmIjoxNDgzNTQ5MzMxLCJzdWIiOiI0YWViMzdiYS1iNjQ1LTQ4ZmQtYWIzMC0xYTAxZWU0MWUyMTgifQ.w6p4J_6qQ1HzTG9nrEOrubxIMb9K5hzcMPxc9IxPx2K4xO9l< span class = "token punctuation" > -< / span > oFiUw93daH3m5pluP6K7eOE6txBuRVfEcpJSwlelsOsW8gb8VJcnzMS9EnZpeA0tW_p< span class = "token punctuation" > -< / span > mnkFc3VcfyXuhe5R3G7aa5d8uHv70yJ9Y3< span class = "token punctuation" > -< / span > UhjiN9EhpMdfPAoEB9fYKKkJRzF7utTTIPGrSaSU6d2pcpfYKaxIwePzEkT4DfcQthoZdy9ucNvvLoi1DIC< span class = "token punctuation" > -< / span > UocFD8HLs8LYKEqSxQvOcvnThbObJ9af71EwmuE21fO5KzMW20KtAeget1gnldOosPtz1G5EwvaQ401< span class = "token punctuation" > -< / span > RPQzPGMVBld0_zMCAwZttJ4knw
< span class = "token key atrule" > idp-certificate-authority< / span > < span class = "token punctuation" > :< / span > /root/ca.pem
< span class = "token key atrule" > idp-issuer-url< / span > < span class = "token punctuation" > :< / span > https< span class = "token punctuation" > :< / span > //oidcidp.tremolo.lan< span class = "token punctuation" > :< / span > 8443/auth/idp/OidcIdP
< span class = "token key atrule" > refresh-token< / span > < span class = "token punctuation" > :< / span > q1bKLFOyUiosTfawzA93TzZIDzH2TNa2SMm0zEiPKTUwME6BkEo6Sql5yUWVBSWpKUGphaWpxSVAfekBOZbBhaEW+VlFUeVRGcluyVF5JT4+haZmPsluFoFu5XkpXk5BXq
< span class = "token key atrule" > name< / span > < span class = "token punctuation" > :< / span > oidc
< / code > < / pre >
< p > 一 旦 您 的 < code > id_token< / code > 过 期 , < code > kubectl< / code > 将 使 用 < code > refresh_token< / code > 刷 新 < code > id_token< / code > , 然 后 在 < code > kube/.config< / code > 文 件 的 < code > client_secret< / code > 中 存 储 < code > id_token< / code > 的 值 和 < code > refresh_token< / code > 的 新 值 。 < / p >
< h5 id = "选项-2---使用---token-选项" > 选 项 2 - 使 用 < code > --token< / code > 选 项 < / h5 >
< p > 可 以 在 < code > kubectl< / code > 命 令 的 < code > --token< / code > 选 项 中 传 入 token。 简 单 的 拷 贝 和 复 制 < code > id_token< / code > 到 该 选 项 中 : < / p >
< pre class = "language-" > < code class = "lang-bash" > kubectl --token< span class = "token operator" > =< / span > eyJhbGciOiJSUzI1NiJ9.eyJpc3MiOiJodHRwczovL21sYi50cmVtb2xvLmxhbjo4MDQzL2F1dGgvaWRwL29pZGMiLCJhdWQiOiJrdWJlcm5ldGVzIiwiZXhwIjoxNDc0NTk2NjY5LCJqdGkiOiI2RDUzNXoxUEpFNjJOR3QxaWVyYm9RIiwiaWF0IjoxNDc0NTk2MzY5LCJuYmYiOjE0NzQ1OTYyNDksInN1YiI6Im13aW5kdSIsInVzZXJfcm9sZSI6WyJ1c2VycyIsIm5ldy1uYW1lc3BhY2Utdmlld2VyIl0sImVtYWlsIjoibXdpbmR1QG5vbW9yZWplZGkuY29tIn0.f2As579n9VNoaKzoF-dOQGmXkFKf1FMyNV0-va_B63jn-_n9LGSCca_6IVMP8pO-Zb4KvRqGyTP0r3HkHxYy5c81AnIh8ijarruczl-TK_yF5akjSTHFZD-0gRzlevBDiH8Q79NAr-ky0P4iIXS8lY9Vnjch5MF74Zx0c3alKJHJUnnpjIACByfF2SCaYzbWFMUNat-K1PaUk5-ujMBG7yYnr95xD-63n8CO8teGUAAEMx6zRjzfhnhbzX-ajwZLGwGUBT4WqjMs70-6a7_8gZmLZb2az1cZynkFRj2BaCkVT3A2RrjeEwZEtGXlMqKJ1_I2ulrOVsYx01_yD35-rw get nodes
< / code > < / pre >
< h3 id = "webhook-token-认证" > Webhook Token 认 证 < / h3 >
< p > Webhook 认 证 是 用 来 认 证 bearer token 的 hook。 < / p >
< ul >
< li > < code > --authentication-token-webhook-config-file< / code > 是 一 个 用 来 描 述 如 何 访 问 远 程 webhook 服 务 的 kubeconfig 文 件 。 < / li >
< li > < code > --authentication-token-webhook-cache-ttl< / code > 缓 存 身 份 验 证 策 略 的 时 间 。 默 认 为 两 分 钟 。 < / li >
< / ul >
< p > 配 置 文 件 使 用 < a href = "https://kubernetes.io/docs/concepts/cluster-administration/authenticate-across-clusters-kubeconfig/" target = "_blank" > kubeconfig< / a > 文 件 格 式 。 文 件 中 的 ” user“ 指 的 是 API server 的 webhook, ” clusters“ 是 指 远 程 服 务 。 见 下 面 的 例 子 : < / p >
< pre class = "language-" > < code class = "lang-yaml" > < span class = "token comment" > # clusters refers to the remote service.< / span >
< span class = "token key atrule" > clusters< / span > < span class = "token punctuation" > :< / span >
< span class = "token punctuation" > -< / span > < span class = "token key atrule" > name< / span > < span class = "token punctuation" > :< / span > name< span class = "token punctuation" > -< / span > of< span class = "token punctuation" > -< / span > remote< span class = "token punctuation" > -< / span > authn< span class = "token punctuation" > -< / span > service
< span class = "token key atrule" > cluster< / span > < span class = "token punctuation" > :< / span >
< span class = "token key atrule" > certificate-authority< / span > < span class = "token punctuation" > :< / span > /path/to/ca.pem < span class = "token comment" > # CA for verifying the remote service.< / span >
< span class = "token key atrule" > server< / span > < span class = "token punctuation" > :< / span > https< span class = "token punctuation" > :< / span > //authn.example.com/authenticate < span class = "token comment" > # URL of remote service to query. Must use ' https' .< / span >
< span class = "token comment" > # users refers to the API server' s webhook configuration.< / span >
< span class = "token key atrule" > users< / span > < span class = "token punctuation" > :< / span >
< span class = "token punctuation" > -< / span > < span class = "token key atrule" > name< / span > < span class = "token punctuation" > :< / span > name< span class = "token punctuation" > -< / span > of< span class = "token punctuation" > -< / span > api< span class = "token punctuation" > -< / span > server
< span class = "token key atrule" > user< / span > < span class = "token punctuation" > :< / span >
< span class = "token key atrule" > client-certificate< / span > < span class = "token punctuation" > :< / span > /path/to/cert.pem < span class = "token comment" > # cert for the webhook plugin to use< / span >
< span class = "token key atrule" > client-key< / span > < span class = "token punctuation" > :< / span > /path/to/key.pem < span class = "token comment" > # key matching the cert< / span >
< span class = "token comment" > # kubeconfig files require a context. Provide one for the API server.< / span >
< span class = "token key atrule" > current-context< / span > < span class = "token punctuation" > :< / span > webhook
< span class = "token key atrule" > contexts< / span > < span class = "token punctuation" > :< / span >
< span class = "token punctuation" > -< / span > < span class = "token key atrule" > context< / span > < span class = "token punctuation" > :< / span >
< span class = "token key atrule" > cluster< / span > < span class = "token punctuation" > :< / span > name< span class = "token punctuation" > -< / span > of< span class = "token punctuation" > -< / span > remote< span class = "token punctuation" > -< / span > authn< span class = "token punctuation" > -< / span > service
< span class = "token key atrule" > user< / span > < span class = "token punctuation" > :< / span > name< span class = "token punctuation" > -< / span > of< span class = "token punctuation" > -< / span > api< span class = "token punctuation" > -< / span > sever
< span class = "token key atrule" > name< / span > < span class = "token punctuation" > :< / span > webhook
< / code > < / pre >
< p > 当 客 户 端 尝 试 使 用 bearer token 与 API server 进 行 认 证 是 , 如 上 论 述 , 认 证 webhook 用 饱 含 该 token 的 对 象 查 询 远 程 服 务 。 Kubernetes 不 会 挑 战 缺 少 该 header 的 请 求 。 < / p >
< p > 请 注 意 , webhook API对 象 与 其 他 Kubernetes API 对 象 具 有 相 同 的 < a href = "https://kubernetes.io/docs/concepts/overview/kubernetes-api/" target = "_blank" > 版 本 控 制 兼 容 性 规 则 < / a > 。 实 现 者 应 该 意 识 到 Beta 对 象 的 宽 松 兼 容 性 承 诺 , 并 检 查 请 求 的 “ apiVersion” 字 段 以 确 保 正 确 的 反 序 列 化 。 此 外 , API server 必 须 启 用 < code > authentication.k8s.io/v1beta1< / code > API 扩 展 组 ( < code > --runtime config =authentication.k8s.io/v1beta1=true< / code > ) 。 < / p >
< p > The request body will be of the following format:< / p >
< pre class = "language-" > < code class = "lang-json" > < span class = "token punctuation" > {< / span >
< span class = "token property" > " apiVersion" < / span > < span class = "token operator" > :< / span > < span class = "token string" > " authentication.k8s.io/v1beta1" < / span > < span class = "token punctuation" > ,< / span >
< span class = "token property" > " kind" < / span > < span class = "token operator" > :< / span > < span class = "token string" > " TokenReview" < / span > < span class = "token punctuation" > ,< / span >
< span class = "token property" > " spec" < / span > < span class = "token operator" > :< / span > < span class = "token punctuation" > {< / span >
< span class = "token property" > " token" < / span > < span class = "token operator" > :< / span > < span class = "token string" > " (BEARERTOKEN)" < / span >
< span class = "token punctuation" > }< / span >
< span class = "token punctuation" > }< / span >
< / code > < / pre >
< p > 预 计 远 程 服 务 将 填 写 请 求 的 < code > status< / code > 字 段 以 指 示 登 录 成 功 。 响 应 主 体 的 < code > spec< / code > 字 段 被 忽 略 , 可 以 省 略 。 成 功 验 证 后 的 bearer token 将 返 回 : < / p >
< pre class = "language-" > < code class = "lang-json" > < span class = "token punctuation" > {< / span >
< span class = "token property" > " apiVersion" < / span > < span class = "token operator" > :< / span > < span class = "token string" > " authentication.k8s.io/v1beta1" < / span > < span class = "token punctuation" > ,< / span >
< span class = "token property" > " kind" < / span > < span class = "token operator" > :< / span > < span class = "token string" > " TokenReview" < / span > < span class = "token punctuation" > ,< / span >
< span class = "token property" > " status" < / span > < span class = "token operator" > :< / span > < span class = "token punctuation" > {< / span >
< span class = "token property" > " authenticated" < / span > < span class = "token operator" > :< / span > < span class = "token boolean" > true< / span > < span class = "token punctuation" > ,< / span >
< span class = "token property" > " user" < / span > < span class = "token operator" > :< / span > < span class = "token punctuation" > {< / span >
< span class = "token property" > " username" < / span > < span class = "token operator" > :< / span > < span class = "token string" > " janedoe@example.com" < / span > < span class = "token punctuation" > ,< / span >
< span class = "token property" > " uid" < / span > < span class = "token operator" > :< / span > < span class = "token string" > " 42" < / span > < span class = "token punctuation" > ,< / span >
< span class = "token property" > " groups" < / span > < span class = "token operator" > :< / span > < span class = "token punctuation" > [< / span >
< span class = "token string" > " developers" < / span > < span class = "token punctuation" > ,< / span >
< span class = "token string" > " qa" < / span >
< span class = "token punctuation" > ]< / span > < span class = "token punctuation" > ,< / span >
< span class = "token property" > " extra" < / span > < span class = "token operator" > :< / span > < span class = "token punctuation" > {< / span >
< span class = "token property" > " extrafield1" < / span > < span class = "token operator" > :< / span > < span class = "token punctuation" > [< / span >
< span class = "token string" > " extravalue1" < / span > < span class = "token punctuation" > ,< / span >
< span class = "token string" > " extravalue2" < / span >
< span class = "token punctuation" > ]< / span >
< span class = "token punctuation" > }< / span >
< span class = "token punctuation" > }< / span >
< span class = "token punctuation" > }< / span >
< span class = "token punctuation" > }< / span >
< / code > < / pre >
< p > 未 成 功 的 请 求 将 返 回 : < / p >
< pre class = "language-" > < code class = "lang-json" > < span class = "token punctuation" > {< / span >
< span class = "token property" > " apiVersion" < / span > < span class = "token operator" > :< / span > < span class = "token string" > " authentication.k8s.io/v1beta1" < / span > < span class = "token punctuation" > ,< / span >
< span class = "token property" > " kind" < / span > < span class = "token operator" > :< / span > < span class = "token string" > " TokenReview" < / span > < span class = "token punctuation" > ,< / span >
< span class = "token property" > " status" < / span > < span class = "token operator" > :< / span > < span class = "token punctuation" > {< / span >
< span class = "token property" > " authenticated" < / span > < span class = "token operator" > :< / span > < span class = "token boolean" > false< / span >
< span class = "token punctuation" > }< / span >
< span class = "token punctuation" > }< / span >
< / code > < / pre >
< p > HTTP状 态 代 码 可 以 用 来 提 供 额 外 的 错 误 上 下 文 。 < / p >
< h3 id = "认证代理" > 认 证 代 理 < / h3 >
< p > 可 以 配 置 API server 从 请 求 header 的 值 中 识 别 用 户 , 例 如 < code > X-Remote-User< / code > 。 这 样 的 设 计 是 用 来 与 请 求 header 值 的 验 证 代 理 结 合 使 用 。 < / p >
< ul >
< li > < code > --requestheader-username-headers< / code > 必 需 , 大 小 写 敏 感 。 按 header 名 称 和 顺 序 检 查 用 户 标 识 。 包 含 值 的 第 一 个 header 将 被 作 为 用 户 名 。 < / li >
< li > < code > --requestheader-group-headers< / code > 1.6 以 上 版 本 。 可 选 。 大 小 写 敏 感 。 建 议 为 “ X-Remote-Group” 。 按 header 名 称 和 顺 序 检 查 用 户 组 。 所 有 指 定 的 header 中 的 所 有 值 都 将 作 为 组 名 。 < / li >
< li > < code > --requestheader-extra-headers-prefix< / code > 1.6 以 上 版 本 。 可 选 , 大 小 写 敏 感 。 建 议 为 “ X-Remote-Extra-” 。 标 题 前 缀 可 用 于 查 找 有 关 用 户 的 额 外 信 息 ( 通 常 由 配 置 的 授 权 插 件 使 用 ) 。 以 任 何 指 定 的 前 缀 开 头 的 header 都 会 删 除 前 缀 , header 名 称 的 其 余 部 分 将 成 为 额 外 的 键 值 , 而 header 值 则 是 额 外 的 值 。 < / li >
< / ul >
< p > 例 如 下 面 的 配 置 : < / p >
< pre class = "language-" > < code class = "lang-bash" > --requestheader-username-headers< span class = "token operator" > =< / span > X-Remote-User
--requestheader-group-headers< span class = "token operator" > =< / span > X-Remote-Group
--requestheader-extra-headers-prefix< span class = "token operator" > =< / span > X-Remote-Extra-
< / code > < / pre >
< p > 该 请 求 : < / p >
< pre class = "language-" > < code class = "lang-http" > GET / HTTP/1.1
< span class = "token header-name keyword" > X-Remote-User:< / span > fido
< span class = "token header-name keyword" > X-Remote-Group:< / span > dogs
< span class = "token header-name keyword" > X-Remote-Group:< / span > dachshunds
< span class = "token header-name keyword" > X-Remote-Extra-Scopes:< / span > openid
< span class = "token header-name keyword" > X-Remote-Extra-Scopes:< / span > profile
< / code > < / pre >
< p > 将 产 生 如 下 的 用 户 信 息 : < / p >
< pre class = "language-" > < code class = "lang-yaml" > < span class = "token key atrule" > name< / span > < span class = "token punctuation" > :< / span > fido
< span class = "token key atrule" > groups< / span > < span class = "token punctuation" > :< / span >
< span class = "token punctuation" > -< / span > dogs
< span class = "token punctuation" > -< / span > dachshunds
< span class = "token key atrule" > extra< / span > < span class = "token punctuation" > :< / span >
< span class = "token key atrule" > scopes< / span > < span class = "token punctuation" > :< / span >
< span class = "token punctuation" > -< / span > openid
< span class = "token punctuation" > -< / span > profile
< / code > < / pre >
< p > 为 了 防 止 header 欺 骗 , 验 证 代 理 需 要 在 验 证 请 求 header 之 前 向 API server 提 供 有 效 的 客 户 端 证 书 , 以 对 照 指 定 的 CA 进 行 验 证 。 < / p >
< ul >
< li > < code > --requestheader-client-ca-file< / code > 必 需 。 PEM 编 码 的 证 书 包 。 在 检 查 用 户 名 的 请 求 header 之 前 , 必 须 针 对 指 定 文 件 中 的 证 书 颁 发 机 构 提 交 并 验 证 有 效 的 客 户 端 证 书 。 < / li >
< li > < code > --requestheader-allowed-names< / code > 可 选 。 Common Name ( cn) 列 表 。 如 果 设 置 了 , 则 在 检 查 用 户 名 的 请 求 header 之 前 , 必 须 提 供 指 定 列 表 中 Common Name( cn) 的 有 效 客 户 端 证 书 。 如 果 为 空 , 则 允 许 使 用 任 何 Common Name。 < / li >
< / ul >
< h3 id = "keystone-密码" > Keystone 密 码 < / h3 >
< p > 通 过 在 启 动 过 程 中 将 < code > --experimental-keystone-url=< span class = "token tag" > < span class = "token tag" > < span class = "token punctuation" > < < / span > AuthURL< / span > < span class = "token punctuation" > > < / span > < / span > < / code > 选 项 传 递 给 API server 来 启 用 Keystone 认 证 。 该 插 件 在 < code > plugin/pkg/auth/authenticator/password/keystone/keystone.go< / code > 中 实 现 , 目 前 使 用 基 本 身 份 验 证 通 过 用 户 名 和 密 码 验 证 用 户 。 < / p >
< p > 如 果 您 为 Keystone 服 务 器 配 置 了 自 签 名 证 书 , 则 在 启 动 Kubernetes API server 时 可 能 需 要 设 置 < code > --experimental-keystone-ca-file=SOMEFILE< / code > 选 项 。 如 果 您 设 置 了 该 选 项 , Keystone 服 务 器 的 证 书 将 由 < code > experimental-keystone-ca-file< / code > 中 的 某 个 权 威 机 构 验 证 。 否 则 , 证 书 由 主 机 的 根 证 书 颁 发 机 构 验 证 。 < / p >
< p > 有 关 如 何 使 用 keystone 来 管 理 项 目 和 用 户 的 详 细 信 息 , 请 参 阅 < a href = "http://docs.openstack.org/developer/keystone/" target = "_blank" > Keystone 文 档 < / a > 。 请 注 意 , 这 个 插 件 仍 处 于 试 验 阶 段 , 正 在 积 极 开 发 之 中 , 并 可 能 在 后 续 版 本 中 进 行 更 改 。 < / p >
< p > 请 参 考 < a href = "https://github.com/kubernetes/kubernetes/pull/11798#issuecomment-129655212" target = "_blank" > 讨 论 < / a > 、 < a href = "https://github.com/kubernetes/kubernetes/issues/11626" target = "_blank" > 蓝 图 < / a > 和 < a href = "https://github.com/kubernetes/kubernetes/pull/25536" target = "_blank" > 提 出 的 改 变 < / a > 获 取 更 多 信 息 。 < / p >
< h2 id = "匿名请求" > 匿 名 请 求 < / h2 >
< p > 启 用 时 , 未 被 其 他 已 配 置 身 份 验 证 方 法 拒 绝 的 请 求 将 被 视 为 匿 名 请 求 , 并 给 予 < code > system:anonymous< / code > 的 用 户 名 和 < code > system:unuthenticated< / code > 的 组 名 。 < / p >
< p > 例 如 , 在 配 置 了 令 牌 认 证 和 启 用 了 匿 名 访 问 的 服 务 器 上 , 提 供 无 效 的 bearer token 的 请 求 将 收 到 < code > 401 Unauthorized< / code > 错 误 。 提 供 bearer token 的 请 求 将 被 视 为 匿 名 请 求 。 < / p >
< p > 在 1.5.1 - 1.5.x 版 本 中 , 默 认 情 况 下 命 名 访 问 是 被 禁 用 的 , 可 以 通 过 传 递 < code > --anonymous-auth=false< / code > 选 项 给 API server 来 启 用 。 < / p >
< p > 在 1.6+ 版 本 中 , 如 果 使 用 < code > AlwaysAllow< / code > 以 外 的 授 权 模 式 , 则 默 认 启 用 匿 名 访 问 , 并 且 可 以 通 过 将 < code > --anonymous-auth=false< / code > 选 项 传 递 给 API服 务 器 来 禁 用 。 从 1.6 开 始 , ABAC 和 RBAC 授 权 人 需 要 明 确 授 权 < code > system:annoymous< / code > 或 < code > system:unauthenticated< / code > 组 , 因 此 授 予 对 < code > *< / code > 用 户 或 < code > *< / code > 组 访 问 权 的 传 统 策 略 规 则 不 包 括 匿 名 用 户 。 < / p >
< h2 id = "用户模拟" > 用 户 模 拟 < / h2 >
< p > 用 户 可 以 通 过 模 拟 header 充 当 另 一 个 用 户 。 该 请 求 会 覆 盖 请 求 认 证 的 用 户 信 息 。 例 如 , 管 理 员 可 以 使 用 此 功 能 通 过 暂 时 模 拟 其 他 用 户 并 查 看 请 求 是 否 被 拒 绝 来 调 试 授 权 策 略 。 < / p >
< p > 模 拟 请 求 首 先 认 证 为 请 求 用 户 , 然 后 切 换 到 模 拟 的 用 户 信 息 。 < / p >
< ul >
< li > 用 户 使 用 他 们 的 凭 证 < em > 和 < / em > 模 拟 header 进 行 API 调 用 。 < / li >
< li > API server 认 证 用 户 < / li >
< li > API server 确 保 经 过 身 份 验 证 的 用 户 具 有 模 拟 权 限 。 < / li >
< li > 请 求 用 户 的 信 息 被 替 换 为 模 拟 值 < / li >
< li > 请 求 被 评 估 , 授 权 作 用 于 模 拟 的 用 户 信 息 。 < / li >
< / ul >
< p > 以 下 HTTP header 可 用 户 执 行 模 拟 请 求 : < / p >
< ul >
< li > < code > Impersonate-User< / code > : 充 当 的 用 户 名 < / li >
< li > < code > Impersonate-Group< / code > : 作 为 组 名 。 可 以 多 次 使 用 来 设 置 多 个 组 。 可 选 的 , 需 要 “ Impersonate-User” < / li >
< li > < code > Impersonate-Extra-( extra name )< / code > : 用 于 将 额 外 字 段 与 用 户 关 联 的 动 态 header。 可 选 。 需 要 “ Impersonate-User” < / li >
< / ul >
< p > 一 组 示 例 header: < / p >
< pre class = "language-" > < code class = "lang-http" > < span class = "token header-name keyword" > Impersonate-User:< / span > jane.doe@example.com
< span class = "token header-name keyword" > Impersonate-Group:< / span > developers
< span class = "token header-name keyword" > Impersonate-Group:< / span > admins
< span class = "token header-name keyword" > Impersonate-Extra-dn:< / span > cn=jane,ou=engineers,dc=example,dc=com
< span class = "token header-name keyword" > Impersonate-Extra-scopes:< / span > view
< span class = "token header-name keyword" > Impersonate-Extra-scopes:< / span > development
< / code > < / pre >
< p > 当 使 用 < code > kubectl< / code > 的 < code > --as< / code > 标 志 来 配 置 < code > Impersonate-User< / code > header 时 , 可 以 使 用 < code > --as-group< / code > 标 志 来 配 置 < code > Impersonate-Group< / code > header。 < / p >
< pre class = "language-" > < code class = "lang-bash" > $ kubectl drain mynode
Error from server < span class = "token punctuation" > (< / span > Forbidden< span class = "token punctuation" > )< / span > : User < span class = "token string" > " clark" < / span > cannot get nodes at the cluster scope. < span class = "token punctuation" > (< / span > get nodes mynode< span class = "token punctuation" > )< / span >
$ kubectl drain mynode --as< span class = "token operator" > =< / span > superman --as-group< span class = "token operator" > =< / span > system:masters
node < span class = "token string" > " mynode" < / span > cordoned
node < span class = "token string" > " mynode" < / span > draine
< / code > < / pre >
< p > 为 模 仿 用 户 、 组 或 设 置 额 外 字 段 , 模 拟 用 户 必 须 能 够 对 正 在 模 拟 的 属 性 的 种 类 ( “ 用 户 ” , “ 组 ” 等 ) 执 行 “ 模 拟 ” 动 词 。 对 于 启 用 了 RBAC 授 权 插 件 的 集 群 , 以 下 ClusterRole 包 含 设 置 用 户 和 组 模 拟 header 所 需 的 规 则 : < / p >
< pre class = "language-" > < code class = "lang-yaml" > < span class = "token key atrule" > apiVersion< / span > < span class = "token punctuation" > :< / span > rbac.authorization.k8s.io/v1
< span class = "token key atrule" > kind< / span > < span class = "token punctuation" > :< / span > ClusterRole
< span class = "token key atrule" > metadata< / span > < span class = "token punctuation" > :< / span >
< span class = "token key atrule" > name< / span > < span class = "token punctuation" > :< / span > impersonator
< span class = "token key atrule" > rules< / span > < span class = "token punctuation" > :< / span >
< span class = "token punctuation" > -< / span > < span class = "token key atrule" > apiGroups< / span > < span class = "token punctuation" > :< / span > < span class = "token punctuation" > [< / span > < span class = "token string" > " " < / span > < span class = "token punctuation" > ]< / span >
< span class = "token key atrule" > resources< / span > < span class = "token punctuation" > :< / span > < span class = "token punctuation" > [< / span > < span class = "token string" > " users" < / span > < span class = "token punctuation" > ,< / span > < span class = "token string" > " groups" < / span > < span class = "token punctuation" > ,< / span > < span class = "token string" > " serviceaccounts" < / span > < span class = "token punctuation" > ]< / span >
< span class = "token key atrule" > verbs< / span > < span class = "token punctuation" > :< / span > < span class = "token punctuation" > [< / span > < span class = "token string" > " impersonate" < / span > < span class = "token punctuation" > ]< / span >
< / code > < / pre >
< p > 额 外 的 字 段 被 评 估 为 资 源 “ userextras” 的 子 资 源 。 为 了 允 许 用 户 使 用 额 外 字 段 “ scope” 的 模 拟 header, 应 授 予 用 户 以 下 角 色 : < / p >
< pre class = "language-" > < code class = "lang-yaml" > < span class = "token key atrule" > apiVersion< / span > < span class = "token punctuation" > :< / span > rbac.authorization.k8s.io/v1
< span class = "token key atrule" > kind< / span > < span class = "token punctuation" > :< / span > ClusterRole
< span class = "token key atrule" > metadata< / span > < span class = "token punctuation" > :< / span >
< span class = "token key atrule" > name< / span > < span class = "token punctuation" > :< / span > scopes< span class = "token punctuation" > -< / span > impersonator
< span class = "token comment" > # Can set " Impersonate-Extra-scopes" header.< / span >
< span class = "token punctuation" > -< / span > < span class = "token key atrule" > apiGroups< / span > < span class = "token punctuation" > :< / span > < span class = "token punctuation" > [< / span > < span class = "token string" > " authentication.k8s.io" < / span > < span class = "token punctuation" > ]< / span >
< span class = "token key atrule" > resources< / span > < span class = "token punctuation" > :< / span > < span class = "token punctuation" > [< / span > < span class = "token string" > " userextras/scopes" < / span > < span class = "token punctuation" > ]< / span >
< span class = "token key atrule" > verbs< / span > < span class = "token punctuation" > :< / span > < span class = "token punctuation" > [< / span > < span class = "token string" > " impersonate" < / span > < span class = "token punctuation" > ]< / span >
< / code > < / pre >
< p > 模 拟 header 的 可 用 值 可 以 通 过 设 置 < code > resourceNames< / code > 可 以 使 用 的 资 源 来 限 制 。 < / p >
< pre class = "language-" > < code class = "lang-yaml" > < span class = "token key atrule" > apiVersion< / span > < span class = "token punctuation" > :< / span > rbac.authorization.k8s.io/v1
< span class = "token key atrule" > kind< / span > < span class = "token punctuation" > :< / span > ClusterRole
< span class = "token key atrule" > metadata< / span > < span class = "token punctuation" > :< / span >
< span class = "token key atrule" > name< / span > < span class = "token punctuation" > :< / span > limited< span class = "token punctuation" > -< / span > impersonator
< span class = "token key atrule" > rules< / span > < span class = "token punctuation" > :< / span >
< span class = "token comment" > # Can impersonate the user " jane.doe@example.com" < / span >
< span class = "token punctuation" > -< / span > < span class = "token key atrule" > apiGroups< / span > < span class = "token punctuation" > :< / span > < span class = "token punctuation" > [< / span > < span class = "token string" > " " < / span > < span class = "token punctuation" > ]< / span >
< span class = "token key atrule" > resources< / span > < span class = "token punctuation" > :< / span > < span class = "token punctuation" > [< / span > < span class = "token string" > " users" < / span > < span class = "token punctuation" > ]< / span >
< span class = "token key atrule" > verbs< / span > < span class = "token punctuation" > :< / span > < span class = "token punctuation" > [< / span > < span class = "token string" > " impersonate" < / span > < span class = "token punctuation" > ]< / span >
< span class = "token key atrule" > resourceNames< / span > < span class = "token punctuation" > :< / span > < span class = "token punctuation" > [< / span > < span class = "token string" > " jane.doe@example.com" < / span > < span class = "token punctuation" > ]< / span >
< span class = "token comment" > # Can impersonate the groups " developers" and " admins" < / span >
< span class = "token punctuation" > -< / span > < span class = "token key atrule" > apiGroups< / span > < span class = "token punctuation" > :< / span > < span class = "token punctuation" > [< / span > < span class = "token string" > " " < / span > < span class = "token punctuation" > ]< / span >
< span class = "token key atrule" > resources< / span > < span class = "token punctuation" > :< / span > < span class = "token punctuation" > [< / span > < span class = "token string" > " groups" < / span > < span class = "token punctuation" > ]< / span >
< span class = "token punctuation" > -< / span > < span class = "token key atrule" > verbs< / span > < span class = "token punctuation" > :< / span > < span class = "token punctuation" > [< / span > < span class = "token string" > " impersonate" < / span > < span class = "token punctuation" > ]< / span >
< span class = "token key atrule" > resourceNames< / span > < span class = "token punctuation" > :< / span > < span class = "token punctuation" > [< / span > < span class = "token string" > " developers" < / span > < span class = "token punctuation" > ,< / span > < span class = "token string" > " admins" < / span > < span class = "token punctuation" > ]< / span >
< span class = "token comment" > # Can impersonate the extras field " scopes" with the values " view" and " development" < / span >
< span class = "token punctuation" > -< / span > < span class = "token key atrule" > apiGroups< / span > < span class = "token punctuation" > :< / span > < span class = "token punctuation" > [< / span > < span class = "token string" > " authentication.k8s.io" < / span > < span class = "token punctuation" > ]< / span >
< span class = "token key atrule" > resources< / span > < span class = "token punctuation" > :< / span > < span class = "token punctuation" > [< / span > < span class = "token string" > " userextras/scopes" < / span > < span class = "token punctuation" > ]< / span >
< span class = "token key atrule" > verbs< / span > < span class = "token punctuation" > :< / span > < span class = "token punctuation" > [< / span > < span class = "token string" > " impersonate" < / span > < span class = "token punctuation" > ]< / span >
< span class = "token key atrule" > resourceNames< / span > < span class = "token punctuation" > :< / span > < span class = "token punctuation" > [< / span > < span class = "token string" > " view" < / span > < span class = "token punctuation" > ,< / span > < span class = "token string" > " development" < / span > < span class = "token punctuation" > ]< / span >
< / code > < / pre >
< h2 id = "附录" > 附 录 < / h2 >
< h3 id = "创建证书" > 创 建 证 书 < / h3 >
< p > 使 用 客 户 端 证 书 进 行 身 份 验 证 时 , 可 以 使 用 现 有 的 部 署 脚 本 或 通 过 < code > easyrsa< / code > 或 < code > openssl< / code > 手 动 生 成 证 书 。 < / p >
< h4 id = "使用已有的部署脚本" > 使 用 已 有 的 部 署 脚 本 < / h4 >
< p > < strong > 已 有 的 部 署 脚 本 < / strong > 在 < code > cluster/saltbase/salt/generate-cert/make-ca-cert.sh< / code > 。 < / p >
< p > 执 行 该 脚 本 时 需 要 传 递 两 个 参 数 。 第 一 个 参 数 是 API server 的 IP地 址 。 第 二 个 参 数 是 IP 形 式 的 主 题 备 用 名 称 列 表 : < code > IP:< span class = "token tag" > < span class = "token tag" > < span class = "token punctuation" > < < / span > ip-address< / span > < span class = "token punctuation" > > < / span > < / span > < / code > 或 < code > DNS:< span class = "token tag" > < span class = "token tag" > < span class = "token punctuation" > < < / span > dns-name< / span > < span class = "token punctuation" > > < / span > < / span > < / code > 。 < / p >
< p > 该 脚 本 将 生 成 三 个 文 件 : < code > ca.crt< / code > 、 < code > server.crt< / code > 和 < code > server.key< / code > 。 < / p >
< p > 最 后 , 将 一 下 参 数 添 加 到 API server 的 启 动 参 数 中 : < / p >
< ul >
< li > < code > --client-ca-file=/srv/kubernetes/ca.crt< / code > < / li >
< li > < code > --tls-cert-file=/srv/kubernetes/server.crt< / code > < / li >
< li > < code > --tls-private-key-file=/srv/kubernetes/server.key< / code > < / li >
< / ul >
< h4 id = "easyrsa" > easyrsa< / h4 >
< p > < strong > easyrsa< / strong > 可 以 用 来 手 动 为 集 群 生 成 证 书 。 < / p >
< ol >
< li > < p > 下 载 , 解 压 , 并 初 始 化 修 补 版 本 的 easyrsa3。 < / p >
< pre class = "language-" > < code class = "lang-bash" > < span class = "token function" > curl< / span > -L -O https://storage.googleapis.com/kubernetes-release/easy-rsa/easy-rsa.tar.gz
< span class = "token function" > tar< / span > xzf easy-rsa.tar.gz
< span class = "token builtin class-name" > cd< / span > easy-rsa-master/easyrsa3
./easyrsa init-pki
< / code > < / pre >
< / li >
< li > < p > 生 成 CA( 使 用 < code > --batch< / code > 设 置 为 自 动 模 式 。 使 用 < code > --req-cn< / code > 设 置 默 认 的 CN) < / p >
< pre class = "language-" > < code class = "lang-bash" > ./easyrsa --batch < span class = "token string" > " --req-cn=< span class = "token variable" > ${MASTER_IP}< / span > @< span class = "token variable" > < span class = "token variable" > `< / span > < span class = "token function" > date< / span > +%s< span class = "token variable" > `< / span > < / span > " < / span > build-ca nopass
< / code > < / pre >
< / li >
< li > < p > 生 成 服 务 器 证 书 和 密 钥 。 ( build-server-full [文 件 名 ]: 生 成 一 个 键 值 对 , 在 本 地 为 客 户 端 和 服 务 器 签 名 。 ) < / p >
< pre class = "language-" > < code class = "lang-bash" > ./easyrsa --subject-alt-name< span class = "token operator" > =< / span > < span class = "token string" > " IP:< span class = "token variable" > ${MASTER_IP}< / span > " < / span > build-server-full server nopass
< / code > < / pre >
< / li >
< li > < p > 复 制 < code > pki/ca.crt< / code > , < code > pki/issued/server.crt< / code > 和 < code > pki/private/server.key< / code > 到 您 的 目 录 下 。 < / p >
< / li >
< li > < p > 将 以 下 参 数 添 加 到 API server 的 启 动 参 数 中 : < / p >
< pre class = "language-" > < code class = "lang-bash" > --client-ca-file< span class = "token operator" > =< / span > /yourdirectory/ca.crt
--tls-cert-file< span class = "token operator" > =< / span > /yourdirectory/server.crt
--tls-private-key-file< span class = "token operator" > =< / span > /yourdirectory/server.key
< / code > < / pre >
< / li >
< / ol >
< h4 id = "openssl" > openssl< / h4 >
< p > < strong > openssl< / strong > 可 以 用 来 手 动 为 集 群 生 成 证 书 。 < / p >
< ol >
< li > < p > 生 成 一 个 2048 bit 的 ca.key: < / p >
< pre class = "language-" > < code class = "lang-bash" > openssl genrsa -out ca.key < span class = "token number" > 2048< / span >
< / code > < / pre >
< / li >
< li > < p > 根 据 ca.key 生 成 一 个 ca.crt( 使 用 -days 设 置 证 书 的 有 效 时 间 ) : < / p >
< pre class = "language-" > < code class = "lang-bash" > openssl req -x509 -new -nodes -key ca.key -subj < span class = "token string" > " /CN=< span class = "token variable" > ${MASTER_IP}< / span > " < / span > -days < span class = "token number" > 10000< / span > -out ca.crt
< / code > < / pre >
< / li >
< li > < p > 生 成 一 个 2048 bit 的 server.key: < / p >
< pre class = "language-" > < code class = "lang-bash" > openssl genrsa -out server.key < span class = "token number" > 2048< / span >
< / code > < / pre >
< / li >
< li > < p > 根 据 server.key 生 成 一 个 server.csr: < / p >
< pre class = "language-" > < code class = "lang-bash" > openssl req -new -key server.key -subj < span class = "token string" > " /CN=< span class = "token variable" > ${MASTER_IP}< / span > " < / span > -out server.csr
< / code > < / pre >
< / li >
< li > < p > 根 据 ca.key、 ca.crt 和 server.csr 生 成 server.crt: < / p >
< pre class = "language-" > < code class = "lang-bash" > openssl x509 -req -in server.csr -CA ca.crt -CAkey ca.key -CAcreateserial -out server.crt -days < span class = "token number" > 10000< / span >
< / code > < / pre >
< / li >
< li > < p > 查 看 证 书 : < / p >
< pre class = "language-" > < code class = "lang-bash" > openssl x509 -noout -text -in ./server.crt
< / code > < / pre >
< / li >
< / ol >
< p > 最 后 , 不 要 忘 了 向 API server 的 启 动 参 数 中 增 加 配 置 。 < / p >
< h4 id = "认证-api" > 认 证 API< / h4 >
< p > 您 可 以 使 用 < code > certificates.k8s.io< / code > API将 x509 证 书 配 置 为 用 于 身 份 验 证 , 如 < a href = "https://kubernetes.io/docs/tasks/tls/managing-tls-in-a-cluster" target = "_blank" > 此 处 < / a > 所 述 。
官 方 最 新 文 档 地 址 : < a href = "https://kubernetes.io/docs/admin/authentication/" target = "_blank" > https://kubernetes.io/docs/admin/authentication/< / a > < / p >
< p > 译 者 : < a href = "https://jimmysong.io" target = "_blank" > Jimmy Song< / a > < / p >
< footer class = "page-footer" > < span class = "copyright" > < a href = "https://cloudnative.to/contact/" target = "_blank" > 加 入 云 原 生 社 区 · 共 谱 云 原 生 新 篇 章 < / a > < p > < / p > Copyright © 2017-2020 | Distributed under < a href = "https://creativecommons.org/licenses/by-nc-sa/4.0/deed.zh" target = "_blank" > CC BY 4.0< / a > | < a href = "https://jimmysong.io" target = "_blank" > jimmysong.io< / a > all right reserved, powered by Gitbook< / span > < span class = "footer-modification" > Updated at
2020-06-24 15:34:21 +08:00
2020-06-24 07:28:52
2020-06-19 14:52:56 +08:00
< / span > < / footer >
< / section >
< / div >
< div class = "search-results" >
< div class = "has-results" >
< h1 class = "search-results-title" > < span class = 'search-results-count' > < / span > results matching "< span class = 'search-query' > < / span > "< / h1 >
< ul class = "search-results-list" > < / ul >
< / div >
< div class = "no-results" >
< h1 class = "search-results-title" > No results matching "< span class = 'search-query' > < / span > "< / h1 >
< / div >
< / div >
< / div >
< / div >
< / div >
< / div >
< a href = "auth-with-kubeconfig-or-token.html" class = "navigation navigation-prev " aria-label = "Previous page: 使用 kubeconfig 或 token 进行用户身份认证" >
< i class = "fa fa-angle-left" > < / i >
< / a >
< a href = "kubernetes-security-best-practice.html" class = "navigation navigation-next " aria-label = "Next page: Kubernetes 集群安全性配置最佳实践" >
< i class = "fa fa-angle-right" > < / i >
< / a >
< / div >
< script >
var gitbook = gitbook || [];
gitbook.push(function() {
2020-06-24 15:34:21 +08:00
gitbook.page.hasChanged({"page":{"title":"Kubernetes 中的用户与身份认证授权","level":"4.4.7","depth":2,"next":{"title":"Kubernetes 集群安全性配置最佳实践","level":"4.4.8","depth":2,"path":"guide/kubernetes-security-best-practice.md","ref":"guide/kubernetes-security-best-practice.md","articles":[]},"previous":{"title":"使用 kubeconfig 或 token 进行用户身份认证","level":"4.4.6","depth":2,"path":"guide/auth-with-kubeconfig-or-token.md","ref":"guide/auth-with-kubeconfig-or-token.md","articles":[]},"dir":"ltr"},"config":{"plugins":["github","codesnippet","splitter","page-toc-button","image-captions","editlink","back-to-top-button","-lunr","-search","search-plus","github-buttons@2.1.0","favicon@^0.0.2","tbfed-pagefooter@^0.0.1","3-ba","theme-default","-highlight","prism","prism-themes","sitemap-general","lightbox","ga","copy-code-button","alerts"],"styles":{"ebook":"styles/ebook.css","epub":"styles/epub.css","mobi":"styles/mobi.css","pdf":"styles/pdf.css","print":"styles/print.css","website":"styles/website.css"},"pluginsConfig":{"tbfed-pagefooter":{"copyright":"< a href = https://cloudnative.to/contact/ > 加入云原生社区·共谱云原生新篇章< / a > < / p > Copyright © 2017-2020 | Distributed under < a href = https://creativecommons.org/licenses/by-nc-sa/4.0/deed.zh > CC BY 4.0< / a > | < a href = https://jimmysong.io > jimmysong.io< / a > ","modify_label":" Updated at ","modify_format":"YYYY-MM-DD HH:mm:ss"},"prism":{"css":["prism-themes/themes/prism-ghcolors.css"]},"github":{"url":"https://github.com/rootsongjc/kubernetes-handbook"},"editlink":{"label":"编辑本页","multilingual":false,"base":"https://github.com/rootsongjc/kubernetes-handbook/blob/master/"},"splitter":{},"codesnippet":{},"sitemap-general":{"prefix":"https://jimmysong.io/kubernetes-handbook/"},"fontsettings":{"theme":"white","family":"sans","size":2},"favicon":{"shortcut":"favicon.ico","bookmark":"favicon.ico"},"lightbox":{"jquery":true,"sameUuid":false},"page-toc-button":{},"back-to-top-button":{},"prism-themes":{},"alerts":{},"github-buttons":{"repo":"rootsongjc/kubernetes-handbook","types":["star"],"size":"small"},"3-ba":{"configuration":"auto","token":"11f7d254cfa4e0ca44b175c66d379ecc"},"copy-code-button":{},"ga":{"configuration":"auto","token":"UA-93485976-1"},"sharing":{"facebook":true,"twitter":true,"google":false,"weibo":false,"instapaper":false,"vk":false,"all":["facebook","google","twitter","weibo","instapaper"]},"theme-default":{"showLevel":true,"styles":{"ebook":"styles/ebook.css","epub":"styles/epub.css","mobi":"styles/mobi.css","pdf":"styles/pdf.css","print":"styles/print.css","website":"styles/website.css"}},"search-plus":{},"image-captions":{"caption":"图 _PAGE_LEVEL_._PAGE_IMAGE_NUMBER_: _CAPTION_","variable_name":"_pictures"}},"theme":"default","author":"Jimmy Song( 宋净超) ","pdf":{"pageNumbers":true,"fontSize":12,"fontFamily":"Arial","paperSize":"a4","chapterMark":"pagebreak","pageBreaksBefore":"/","margin":{"right":62,"left":62,"top":56,"bottom":56}},"structure":{"langs":"LANGS.md","readme":"README.md","glossary":"GLOSSARY.md","summary":"SUMMARY.md"},"variables":{"_pictures":[{"backlink":"index.html#fig1.1.1","level":"1.1","list_caption":"Figure: Stargazers over time","alt":"Stargazers over time","nro":1,"url":"https://starcharts.herokuapp.com/rootsongjc/kubernetes-handbook.svg","index":1,"caption_template":"图 _PAGE_LEVEL_._PAGE_IMAGE_NUMBER_: _CAPTION_","label":"Stargazers over time","attributes":{},"skip":false,"key":"1.1.1"},{"backlink":"cloud-native/play-with-kubernetes.html#fig2.3.1","level":"2.3","list_caption":"Figure: Play with Kubernetes网页截图","alt":"Play with Kubernetes网页截图","nro":2,"url":"../images/play-with-kubernetes.jpg","index":1,"caption_template":"图 _PAGE_LEVEL_._PAGE_IMAGE_NUMBER_: _CAPTION_","label":"Play with Kubernetes网页截图","attributes":{},"skip":false,"key":"2.3.1"},{"backlink":"cloud-native/cloud-native-local-quick-start.html#fig2.4.1","level":"2.4","list_caption":"Figure: Kubernetes dashboard","alt":"Kubernetes dashboard","nro":3,"url":"https://githu
2020-06-19 14:52:56 +08:00
});
< / script >
< / div >
< script src = "../gitbook/gitbook.js" > < / script >
< script src = "../gitbook/theme.js" > < / script >
< script src = "../gitbook/gitbook-plugin-github/plugin.js" > < / script >
< script src = "../gitbook/gitbook-plugin-splitter/splitter.js" > < / script >
< script src = "../gitbook/gitbook-plugin-page-toc-button/plugin.js" > < / script >
< script src = "../gitbook/gitbook-plugin-editlink/plugin.js" > < / script >
< script src = "../gitbook/gitbook-plugin-back-to-top-button/plugin.js" > < / script >
< script src = "../gitbook/gitbook-plugin-search-plus/jquery.mark.min.js" > < / script >
< script src = "../gitbook/gitbook-plugin-search-plus/search.js" > < / script >
< script src = "../gitbook/gitbook-plugin-github-buttons/plugin.js" > < / script >
< script src = "../gitbook/gitbook-plugin-3-ba/plugin.js" > < / script >
< script src = "../gitbook/gitbook-plugin-lightbox/js/lightbox.min.js" > < / script >
< script src = "../gitbook/gitbook-plugin-ga/plugin.js" > < / script >
< script src = "../gitbook/gitbook-plugin-copy-code-button/toggle.js" > < / script >
< script src = "../gitbook/gitbook-plugin-alerts/plugin.js" > < / script >
< script src = "../gitbook/gitbook-plugin-sharing/buttons.js" > < / script >
< script src = "../gitbook/gitbook-plugin-fontsettings/fontsettings.js" > < / script >
< / body >
< / html >