Knative基本概念

2018-10-19  本文已影响0人  pxzero_wen

Object

Knative offers a set of reusable components that focuses on solving many mundane but difficult tasks such as orchestrating source-to-container workflows, routing and managing traffic during deployment, auto-scaling your workloads, or binding running services to eventing ecosystems.

Serving : Scale to zero, request-driven compute model

Build : Cloud-native source to container orchestration

Events : Universal subscription, delivery and management of events

Serving

The Knative Serving project provides middleware primitives that enable:

Knative Serving defines a set of objects as Kubernetes Custom Resource Definitions (CRDs). These objects are used to define and control how your serverless workload behaves on the cluster:

image

<input type="file" accept=".jpg, .jpeg, .png, .gif" style="display: none;">

The primary resources in the Knative Serving API are Routes, Revisions, Configurations, and Services:

Route provides a network endpoint for a user's service

Revision is an immutable snapshot of code and configuration. Revisions are created by updates to a Configuration.

A Configuration describes the desired latest Revision state, and creates and tracks the status of Revisions as the desired state is updated. A configuration might include instructions on how to transform a source package (either git repo or archive) into a container by referencing a Build, or might simply reference a container image and associated execution metadata needed by the Revision.

A Service encapsulates a set of Routes and Configurations which together provide a software component. Service exists to provide a singular abstraction which can be access controlled, reasoned about, and which encapsulates software lifecycle decisions such as rollout policy and team resource ownership. Service acts only as an orchestrator of the underlying Routes and Configurations (much as a kubernetes Deployment orchestrates ReplicaSets), and its usage is optional but recommended.

The Service's controller will track the statuses of its owned Configuration and Route, reflecting their statuses and conditions as its own.

The owned Configurations' Ready conditions are surfaced as the Service's ConfigurationsReady condition. The owned Routes' Ready conditions are surfaced as the Service's RoutesReady condition.

Build

This repository contains a work-in-progress build system that is designed to address a common need for cloud native development.

While Knative builds are optimized for building, testing, and deploying source code, you are still responsible for developing the corresponding components that:

Key features of Knative Builds

Example:

apiVersion: build.knative.dev/v1alpha1
kind: Build
metadata:
  name: example-build
spec:
  serviceAccountName: build-auth-example
  source:
    git:
      url: https://github.com/example/build-example.git
      revision: master
  steps:
  - name: ubuntu-example
    image: ubuntu
    args: ["ubuntu-build-example", "SECRETS-example.md"]
  steps:
  - image: gcr.io/example-builders/build-example
    args: ['echo', 'hello-example', 'build']

What is a Builder?
A Builder image is a special classification for images that run as a part of the Build CRD's steps:.
For example, in the following Build the images, gcr.io/cloud-builders/gcloud and gcr.io/cloud-builders/docker are "Builders".:

spec:
  steps:
  - image: gcr.io/cloud-builders/gcloud
    ...
  - image: gcr.io/cloud-builders/docker
    ...

https://github.com/googlecloudplatform/cloud-builders
https://github.com/googlecloudplatform/cloud-builders-community

上一篇下一篇

猜你喜欢

热点阅读