diff --git a/appendix/material-share.md b/appendix/material-share.md index df014f824..1b4173728 100644 --- a/appendix/material-share.md +++ b/appendix/material-share.md @@ -33,10 +33,6 @@ Kubernetes 社区的贡献、交流和治理方式相关的内容都保存在 注意:Rudr 是对 [OAM v1alpha1](https://github.com/oam-dev/spec/releases/tag/v1.0.0-alpha.1) 在 Kubernetes 环境下的实现,OAM 正在与 [Crossplane](https://github.com/crossplane/) 合作,不建议再使用 Rudr。 - -**Crossplane** - -[Crossplane](./crossplane.md) 使用 Kubernetes 社区开创的以 API 为中心的声明式配置和自动化方法,使基础设施和应用管理标准化。官方网站:。 - -### 安装 Rudr - -请参考 [Rudr 文档](https://github.com/oam-dev/rudr/blob/master/docs/setup/install.md)安装,主要依赖以下组件: - -- kubectl -- helm 3 -- Kubernetes 1.15+ - -执行下面的命令安装 Rudr 和需要的 trait。 - -```bash -# 克隆项目 -git clone https://github.com/oam-dev/rudr.git -cd rudr -# 创建一个名为 oam 的 namespace -kubectl create namespace oam -# 安装 Rudr -helm install rudr ./charts/rudr --wait -n oam -# 要使用 ingress trait,推荐安装 Nginx ingress -helm repo add stable https://kubernetes-charts.storage.googleapis.com/ -helm install nginx-ingress stable/nginx-ingress -# 要使用 autoscaler trait,安装 HorizontalPodAutoscaler -helm repo add kedacore https://kedacore.github.io/charts -helm repo update -helm install keda kedacore/keda -n oam -``` - -查看当前 oam namespace 下的所有 pod,你会发现已创建了以下 pod。 - - ```bash -$ kubectl get pod -n oam -NAME READY STATUS RESTARTS AGE -keda-operator-b6466c989-pn25n 1/1 Running 0 63m -keda-operator-metrics-apiserver-6cf88c468-k5wd8 1/1 Running 0 63m -nginx-ingress-controller-787bd69d8-n6v8c 1/1 Running 15 7d -nginx-ingress-default-backend-7c868597f4-vvddn 1/1 Running 2 7d -rudr-c648c9b7b-knj9b 1/1 Running 7 7d - ``` - -## 部署示例 - -我们使用 OAM 官方提供的教程 [Tutorial: Deploy, inspect, and update a Rudr application and its components](https://github.com/oam-dev/rudr/blob/master/docs/tutorials/deploy_and_update.md) 中的 Python [flask](https://palletsprojects.com/p/flask/) 示例,该示例基于 OAM v1alpha1 API,最新版 API 的示例可以参考 [crossplane-oam-sample](https://github.com/oam-dev/crossplane-oam-sample)。 - -```bash -# 部署 Component - -kubectl apply -f examples/helloworld-python-component.yaml -``` - -此时 get pod 会发现并没有创建任何新的 pod,因为 [examples/helloworld-python-component.yaml](https://github.com/oam-dev/rudr/blob/master/examples/helloworld-python-component.yaml) 文件中只定义了一个名为 `helloworld-python-v1` 的 `ComponentSchematic`,但是 `ComponentSchematic` 是仅仅是定义了一个组件而已,还无法直接创建 pod 的,还需要创建一个 `ApplicationConfiguration` 将其与 `Trait` 绑定才可以创建应用的 pod。 - -关于该示例的详细信息请参考 [Python flask 示例](https://github.com/oam-dev/rudr/blob/master/docs/how-to/create_component_from_scratch.md)的创建步骤。 - -### 创建应用配置 - -在部署了 `ComponentSchematic` 之后我们还需要创建一个 `ApplicationConfiguration` 将其与 `Trait` 资源绑定才可以创建应用。 - -**当前已有的 Trait** - -在安装 Rudr 时已在 oam namespace 中部署了一些 trait,使用下面的命令查看。 - -```bash -$ kubectl get trait -n oam -NAME AGE -auto-scaler 7d1h -empty 7d1h -ingress 7d1h -manual-scaler 7d1h -volume-mounter 7d1h -``` - -在 [examples/first-app-config.yaml](https://github.com/oam-dev/rudr/blob/master/examples/first-app-config.yaml) 中将 `ComponentSchematic` 与 ingress `Trait` 联系起来。一个完整的可部署的应用配置 [examples/first-app-config.yaml](https://github.com/oam-dev/rudr/blob/master/examples/first-app-config.yaml) 的内容如下所示: - -```yaml -apiVersion: core.oam.dev/v1alpha1 -kind: ApplicationConfiguration -metadata: - name: first-app -spec: - components: - - componentName: helloworld-python-v1 # 引用了上文中的 Component - instanceName: first-app-helloworld-python-v1 - parameterValues: - - name: target - value: Rudr - - name: port - value: '9999' - traits: - - name: ingress # Ingress 引用,Rudr 已默认创建 - properties: - hostname: example.com - path: / - servicePort: 9999 -``` - -执行下面的命令部署应用。 - -```bash -kubectl apply -f examples/first-app-config.yaml -n oam -``` - -若此时查看 oam namespace 下的 pod 将发现有一个新的 pod 创建。 - -```bash -$ kubectl get pod -o oam -NAME READY STATUS RESTARTS AGE -first-app-helloworld-python-v1-69945684c7-wfd82 1/1 Running 0 16m -... -``` - -### 测试 - -执行下面的命令可以测试刚安装的应用。 - -```bash -# 将 Python flask 应用的 pod 暴露到本机 -export POD_NAME=$(kubectl get pods -l "oam.dev/instance-name=first-app-helloworld-python-v1,app.kubernetes.io/name=first-app" -o jsonpath="{.items[0].metadata.name}") -kubectl port-forward $POD_NAME 9999:9999 -Forwarding from 127.0.0.1:9999 -> 9999 -Forwarding from [::1]:9999 -> 9999 -``` - -在浏览器中访问 将看到 `Hello Rudr!` 的输出,这表示测试成功。 - ## 未来 从以上描述中可以看出 OAM 对于定义云原生应用标准的野望,其目标不仅限于 Kubernetes 之上的又一上层抽象,而是对于一切云服务,在基于资源对象的基础上,Trait 来控制 Kubernetes 中的一众高层次非可调度的资源对象,如 AutoScaler、Volume、Ingress,Istio 中的流量配置对象 VirtualService、DestinationRule 等,还可容纳更多的云服务,对于 Serverless 时代的去基础设施化的思想不谋而合,未来可期。 diff --git a/concepts/crd.md b/concepts/crd.md index 3a91ec724..94521d1bc 100644 --- a/concepts/crd.md +++ b/concepts/crd.md @@ -152,10 +152,6 @@ Error from server (NotFound): Unable to list "crontabs": the server could not fi 如果稍后重新创建相同的 CustomResourceDefinition,它将从空开始。 -## 提供 CRD 的多个版本 - -有关提供 CustomResourceDefinition 的多个版本以及将对象从一个版本迁移到另一个版本的详细信息,请参阅[自定义资源定义版本控制](https://kubernetes.io/docs/tasks/access-kubernetes-api/custom-resources/custom-resource-definition-versioning/)。 - ## 高级主题 ### Finalizer(终结器) diff --git a/concepts/horizontal-pod-autoscaling.md b/concepts/horizontal-pod-autoscaling.md index 3ce0e0eb4..75c1c1cf1 100644 --- a/concepts/horizontal-pod-autoscaling.md +++ b/concepts/horizontal-pod-autoscaling.md @@ -144,10 +144,6 @@ Kubernetes 然后查询新的自定义 metric API 来获取相应自定义 metri ## 参考 -- HPA说明:https://kubernetes.io/docs/tasks/run-application/horizontal-pod-autoscale/ - -- HPA详解:https://kubernetes.io/docs/tasks/run-application/horizontal-pod-autoscale-walkthrough/ - -- 自定义metrics开发:https://github.com/kubernetes/metrics - -- 1.7版本的kubernetes中启用自定义HPA:[Configure Kubernetes Autoscaling With Custom Metrics in Kubernetes 1.7 - Bitnami](https://docs.bitnami.com/kubernetes/how-to/configure-autoscaling-custom-metrics/) +- [HPA说明 - kubernetes.io(https://kubernetes.io/docs/tasks/run-application/horizontal-pod-autoscale/) +- [HPA详解 - kubernetes.io](https://kubernetes.io/docs/tasks/run-application/horizontal-pod-autoscale-walkthrough/) +- [自定义metrics开发 - github.com](https://github.com/kubernetes/metrics) diff --git a/develop/operator.md b/develop/operator.md index 5b8c7c712..e60419aab 100644 --- a/develop/operator.md +++ b/develop/operator.md @@ -1,6 +1,6 @@ # Operator -Operator是由[CoreOS](https://coreos.com)开发的,用来扩展Kubernetes API,特定的应用程序控制器,它用来创建、配置和管理复杂的有状态应用,如数据库、缓存和监控系统。Operator基于Kubernetes的资源和控制器概念之上构建,但同时又包含了应用程序特定的领域知识。创建Operator的关键是CRD(自定义资源)的设计。 +Operator是由[CoreOS](https://coreos.com)开发的,用来扩展Kubernetes API,特定的应用程序控制器,它用来创建、配置和管理复杂的有状态应用,如数据库、缓存和监控系统。Operator基于Kubernetes的资源和控制器概念之上构建,但同时又包含了应用程序特定的领域知识。创建Operator的关键是CRD(自定义资源)的设计。[awesome-operators](https://github.com/operator-framework/awesome-operators) 中罗列了目前已知的 Operator。 ## 工作原理 @@ -8,8 +8,6 @@ Operator是将运维人员对软件操作的知识给代码化,同时利用Kub Operator使用了Kubernetes的自定义资源扩展API机制,如使用[CRD](../concepts/custom-resource.md)(CustomResourceDefinition)来创建。Operator通过这种机制来创建、配置和管理应用程序。 -当前CoreOS依靠社区力量创建了众多的 Operator,见:。 - Operator基于Kubernetes的以下两个概念构建: - 资源:对象的状态定义 @@ -52,17 +50,10 @@ Operator本质上是与应用息息相关的,因为这是特定领域的知识 6. Operator应该让用户能够根据版本声明来选择所需版本和编排应用程序升级。不升级软件是操作错误和安全问题的常见来源,Operator可以帮助用户更加自信地解决这一问题。 7. Operator应该进行“Chaos Monkey”测试,以模拟Pod、配置和网络故障的情况下的行为。 -## OperatorHub - -我们都知道在 Kubernetes 上安装应用可以使用 Helm 直接安装各种打包成 Chart 形式的 Kubernetes 应用,但随着 Kubernetes Operator 的流行,Kubernetes 社区又推出了 [OperatorHub](https://www.operatorhub.io/),你可以在这里分享或安装 Operator:。 - -另外,[awesome-operators](https://github.com/operator-framework/awesome-operators) 中罗列了目前已知的 Operator。 - ## 参考 - [Operators - coreos.com](https://coreos.com/operators) - [awesome-operators - github.com](https://github.com/operator-framework/awesome-operators) -- [OperatorHub - operatorhub.io](https://www.operatorhub.io) - [Writing a Kubernetes Operator in Golang](https://medium.com/@mtreacher/writing-a-kubernetes-operator-a9b86f19bfb9) - [Introducing Operators: Putting Operational Knowledge into Software - coreos.com](https://coreos.com/blog/introducing-operators.html) - [Automating Kubernetes Cluster Operations with Operators - thenewstack.io](https://thenewstack.io/automating-kubernetes-cluster-operations-operators/) diff --git a/practice/configuration-best-practice.md b/practice/configuration-best-practice.md index 5fb1bf8de..03cf80adf 100644 --- a/practice/configuration-best-practice.md +++ b/practice/configuration-best-practice.md @@ -30,7 +30,7 @@ 可以通过简单地从其service的选择器中省略特定于发行版本的标签,而不是更新服务的选择器来完全匹配replication controller的选择器,来实现跨越多个部署的服务,例如滚动更新。 -- 为了滚动升级的方便,在Replication Controller的名字中包含版本信息,例如作为名字的后缀。设置一个`version`标签页是很有用的。滚动更新创建一个新的controller而不是修改现有的controller。因此,version含混不清的controller名字就可能带来问题。查看[Rolling Update Replication Controller](https://kubernetes.io/docs/tasks/run-application/rolling-update-replication-controller/)文档获取更多关于滚动升级命令的信息。 +- 为了滚动升级的方便,在Replication Controller的名字中包含版本信息,例如作为名字的后缀。设置一个`version`标签页是很有用的。滚动更新创建一个新的controller而不是修改现有的controller。 注意 [Deployment](https://kubernetes.io/docs/concepts/workloads/controllers/deployment/) 对象不需要再管理 replication controller 的版本名。Deployment 中描述了对象的期望状态,如果对spec的更改被应用了话,Deployment controller 会以控制的速率来更改实际状态到期望状态。(Deployment目前是 [`extensions` API Group](https://kubernetes.io/docs/concepts/overview/kubernetes-api/#api-groups)的一部分)。 diff --git a/practice/install-kubernetes-on-centos.md b/practice/install-kubernetes-on-centos.md index 29c8bfde3..61eaa5c90 100644 --- a/practice/install-kubernetes-on-centos.md +++ b/practice/install-kubernetes-on-centos.md @@ -35,7 +35,7 @@ + RBAC 授权 + kubelet TLS BootStrapping + kubedns、dashboard、heapster(influxdb、grafana)、EFK(elasticsearch、fluentd、kibana) 集群插件 -+ 私有docker镜像仓库[harbor](https://github.com/vmware/harbor)(请自行部署,harbor提供离线安装包,直接使用docker-compose启动即可) ++ 私有docker镜像仓库[harbor](https://github.com/goharbor/harbor)(请自行部署,harbor提供离线安装包,直接使用docker-compose启动即可) ## 环境说明 diff --git a/scripts/lint-gitbook.sh b/scripts/lint-gitbook.sh index fb6e05915..db7ee38af 100755 --- a/scripts/lint-gitbook.sh +++ b/scripts/lint-gitbook.sh @@ -5,4 +5,4 @@ mdspell --version echo -ne "mdl " mdl --version htmlproofer --version -htmlproofer --url-ignore "/localhost/,/172.17.8.101/,/172.20.0.113/,/slideshare.net/,/grpc.io/,/kiali.io/,/condiut.io/,/twitter.com/,/facebook.com/,/medium.com/,/google.com/,/jimmysong.io/,/openfaas.com/,/linkerd.io/,/layer5.io/,/thenewstack.io/,/blog.envoyproxy.io/,/blog.openebs.io/,/k8smeetup.github.io/,/blog.heptio.com/,/apigee.com/,/speakerdeck.com/,/download.svcat.sh/,/blog.fabric8.io/,/blog.heptio.com/,/blog.containership.io/,/blog.mobyproject.org/,/blog.spinnaker.io/,/coscale.com/,/zh.wikipedia.org/,/labs.play-with-k8s.com/,/cilium.readthedocs.io/,/azure.microsoft.com/,/storageos.com/,/openid.net/,/prometheus.io/,/coreos.com/,/openwhisk.incubator.apache.org/,/dockone.io/,/jianshu.com/,/cloudstax.io/,/spring.io/" _book +htmlproofer --url-ignore "/localhost/,/servicemesher.com/,/172.17.8.101/,/172.20.0.113/,/slideshare.net/,/grpc.io/,/kiali.io/,/condiut.io/,/twitter.com/,/facebook.com/,/medium.com/,/google.com/,/jimmysong.io/,/openfaas.com/,/linkerd.io/,/layer5.io/,/thenewstack.io/,/blog.envoyproxy.io/,/blog.openebs.io/,/k8smeetup.github.io/,/blog.heptio.com/,/apigee.com/,/speakerdeck.com/,/download.svcat.sh/,/blog.fabric8.io/,/blog.heptio.com/,/blog.containership.io/,/blog.mobyproject.org/,/blog.spinnaker.io/,/coscale.com/,/zh.wikipedia.org/,/labs.play-with-k8s.com/,/cilium.readthedocs.io/,/azure.microsoft.com/,/storageos.com/,/openid.net/,/prometheus.io/,/coreos.com/,/openwhisk.incubator.apache.org/,/dockone.io/,/jianshu.com/,/cloudstax.io/,/spring.io/" _book diff --git a/usecases/how-to-integrate-istio-with-vm.md b/usecases/how-to-integrate-istio-with-vm.md index 7741c0eb7..f1e170780 100644 --- a/usecases/how-to-integrate-istio-with-vm.md +++ b/usecases/how-to-integrate-istio-with-vm.md @@ -1,6 +1,6 @@ # Istio 如何支持虚拟机 -> 本文基于 Istio 1.7 版本撰写。 +注:本文基于 Istio 1.7 版本撰写。 Istio 是目前最流行的服务网格,用于连接、保护、控制和观察服务。当其 2017 年开源时,Kubernetes 已赢得容器编排之战,Istio 为了满足组织转向微服务的需求。虽然 Istio 声称支持异构环境,如 Nomad、Consul、Eureka、Cloud Foundry、Mesos 等,但实际上,它一直与 Kubernetes 合作得最好——它的服务发现就是基于 Kubernetes。 @@ -49,17 +49,13 @@ Istio 社区和 [Tetrate](https://www.tetrate.io/) 在 Istio 对虚拟机的支 7. 将虚拟机中的 MySQL 服务作为 ServiceEntry 引入到 Mesh 中并作为 rating 服务的后端; 8. 修改 MySQL 表中的数据,验证 bookinfo 中的 rating 相应的行为符合预期; -点击下图[查看 Demo 视频](https://www.bilibili.com/video/bv1Wp4y167QT)。 - -[![Istio 支持虚拟机 Demo 视频](../images/istio-vm-demo-video.jpg)](https://www.bilibili.com/video/bv1Wp4y167QT) - ## 未来方向 从 [bookinfo](https://istio.io/latest/docs/examples/virtual-machines/bookinfo/) 的演示中可以看出,在这个过程中涉及到的人工工作太多,很容易出错。在未来,Istio 会改进虚拟机测试的可操作性,根据平台身份自动引导,改进 DNS 支持和 istioctl 调试等。大家可以关注 [Istio 环境工作组](https://github.com/istio/community/blob/master/WORKING-GROUPS.md),了解更多关于虚拟机支持的细节。 ## 参考阅读 -- [Virtual Machine Installation](https://istio.io/latest/docs/setup/install/virtual-machine/) -- [Virtual Machines in Single-Network Meshes](https://istio.io/latest/docs/examples/virtual-machines/single-network/) -- [Istio: Bringing VMs into the Mesh (with Cynthia Coan)](https://www.tetrate.io/blog/istio-bringing-vms-into-the-mesh-with-cynthia-coan/) -- [Bridging Traditional and Modern Workloads](https://www.tetrate.io/blog/bridging-traditional-and-modern-workloads/) \ No newline at end of file +- [Virtual Machine Installation - istio.io](https://istio.io/latest/docs/setup/install/virtual-machine/) +- [Virtual Machines in Single-Network Meshes - istio.io](https://istio.io/latest/docs/examples/virtual-machines/single-network/) +- [Istio: Bringing VMs into the Mesh (with Cynthia Coan) - tetrate.io](https://www.tetrate.io/blog/istio-bringing-vms-into-the-mesh-with-cynthia-coan/) +- [Bridging Traditional and Modern Workloads - tetrate.io](https://www.tetrate.io/blog/bridging-traditional-and-modern-workloads/) \ No newline at end of file