OAM,open application model是阿里巴巴和微软共同开发的云原生应用规范模型。它使用来解决一个完整的面向业务场景的应用的问题。是一个标准的、基础设施 无关的跨云应用部署模型。有以下几个特性:
OAM规范遵循以下原则



OAM Spec 定义了云原生应用的规范(使用一些 CRD 定义), KubeVela 可以看做是 OAM 规范的解析器,将应用定义翻译为 Kubernetes 中的资源对象。可以将上图分为三个层次:
参考管官网
OAM应用,主要通过kubevela项目来实现
kubevela项目地址 模块定义(Definition) | KubeVela
KubeVela 是一个开箱即用的现代化应用交付与管理平台,它使得应用在面向混合云环境中的交付更简单、快捷。使用 KubeVela 的软件开发团队,可以按需使用云原生能力构建应用,随着团队规模的发展、业务场景的变化扩展其功能,一次构建应用,随处运行。

KubeVela 的核心是将应用部署所需的所有组件和各项运维动作,描述为一个统一的、与基础设施无关的“部署计划”,进而实现在混合环境中标准化和高效率的应用交付。这使得最终用户无需关注底层细节,就可以使用丰富的扩展能力,并基于统一的概念自助式操作。

每一个应用部署计划都由四个部分组成,分别是组件,运维能力,部署策略和工作流
apiVersion: core.oam.dev/v1beta1 kind: Application metadata: name: spec: components: - name: type: properties: traits: - type: properties: - name: type: properties: policies: - name: type: properties: workflow: - name: type: properties: 这个 Application 对象会引用 component、trait、policy 以及 workflow step 的类型,这些类型背后是平台构建者(运维团队)维护的可编程模块。可以看到,这种抽象的方式是高度可扩展、可定制的。

要求,
curl-fsSl https://kubevela.io/script/install.sh | bash vela install VelaUX 是 KubeVela 的仪表板。 它是在你的集群中运行的 Web 应用程序。 你可以使用浏览器访问它。 如果你不使用 KubeVela 的 UI 控制台,这是可选的
在k8s上部署应用举例
apiVersion: core.oam.dev/v1beta1 kind: Application metadata: name: app-with-k8s-objects namespace: default spec: components: - name: k8s-demo-service properties: objects: - apiVersion: apps/v1 kind: Deployment metadata: name: nginx spec: replicas: 2 selector: matchLabels: app: nginx strategy: type: Recreate template: metadata: labels: app: nginx spec: containers: - image: nginx name: nginx ports: - containerPort: 80 - apiVersion: v1 kind: Service metadata: annotations: service.beta.kubernetes.io/aws-load-balancer-type: nlb labels: app: nginx name: nginx namespace: default spec: externalTrafficPolicy: Local ports: - name: http port: 80 protocol: TCP targetPort: 80 selector: app: nginx type: LoadBalancer type: k8s-objects policies: - name: topology-default type: topology properties: clusters: ['local'] namespace: default - name: topology-production type: topology properties: clusters: ['local'] namespace: production workflow: steps: - name: deploy2default properties: policies: ['topology-default'] type: deploy - name: suspend type: suspend - name: deploy2production properties: policies: ['topology-production'] type: deploy #部署应用 $ vela up -f https://kubevela.io/example/applications/app-with-k8s-objects.yaml #执行审核 $ vela workflow resume app-with-k8s-objects 这里没有使用 velaux 插件,而是是在商业k8s平台上可以更加简洁直观的看到OAM状态



OAM是一种全新的K8S业务交付方式,但是目前还不上主流,目前应用的不多
上一篇:云计算——ACA学习 云计算概述
下一篇:小乌龟操作Git【全】