0Pricing
Docker & Kubernetes for Developers · 강의

Kubernetes를 활용한 서버리스(Knative)

Knative와 같은 플랫폼이 Kubernetes 위에서 서버리스 함수와 이벤트 기반 아키텍처를 구현하는 방식을 살펴봅니다.

Kubernetes를 활용한 서버리스(Knative)은(는) CoddyKit의 무료 Docker & Kubernetes for Developers 강의입니다. 이것은 4개 중 3번째 강의입니다. 아래에서 전체 강의를 무료로 읽을 수 있으며, 내장 코드 에디터와 24/7 AI 튜터와 함께 브라우저에서 직접 실습할 수 있습니다. 이 강의는 Docker & Kubernetes for Developers 학습 경로의 일부이며, 진행 상황이 웹과 CoddyKit 앱에 동기화됩니다. Docker & Kubernetes for Developers 강의에는 총 4개의 강의가 포함되어 있습니다.

이 강의의 일부는 아직 번역되지 않았으며 영어로 표시됩니다.

Serverless & Kubernetes

Welcome to the world of serverless on Kubernetes! Serverless computing allows you to run code without provisioning or managing servers, focusing purely on your application logic.

By combining serverless with Kubernetes, you get the benefits of both: the agility and cost-efficiency of serverless, backed by the robust, scalable, and portable infrastructure management of Kubernetes.

Knative: K8s Serverless

Knative is an open-source platform that extends Kubernetes to provide components for deploying, running, and managing serverless workloads. It simplifies the complexities of running serverless applications.

Knative has two main components: Knative Serving, which handles request-driven services, and Knative Eventing, for event-driven architectures.

Knative Serving Basics

Knative Serving is designed for deploying and managing stateless services. It takes care of:

  • Rapid Deployment: Quickly deploys container images.
  • Auto-scaling: Scales services up and down based on demand, even to zero instances when idle.
  • Revision Management: Provides immutable revisions for easy rollbacks and traffic splitting.

It's perfect for web applications, APIs, and microservices.

Serving: Services & Revisions

Key concepts in Knative Serving:

  • Service: The top-level resource, defining the desired state of your application.
  • Revision: An immutable snapshot of your service's code and configuration at a specific point in time. New deployments create new revisions.
  • Route: Manages network traffic to one or more revisions, enabling features like A/B testing or gradual rollouts.

These components work together to provide a robust deployment and scaling mechanism.

Defining a Knative Service

A Knative Service is defined using a YAML manifest, much like other Kubernetes resources. This example defines a simple 'hello-knative' service using a pre-built image.

Notice the serving.knative.dev/v1 API version and the kind: Service.

apiVersion: serving.knative.dev/v1
kind: Service
metadata:
  name: hello-knative
spec:
  template:
    spec:
      containers:
        - image: docker.io/knative/helloworld-go
          env:
            - name: TARGET
              value: "Knative"

Simple Serverless App

This is a basic Python Flask application that Knative would deploy. It listens for HTTP requests and responds with a greeting, using an environment variable for customization. Knative handles the containerization, deployment, and scaling of this app.

from flask import Flask
import os

app = Flask(__name__)

@app.route('/')
def hello():
    target = os.environ.get('TARGET', 'World')
    return f'Hello {target}!\n'

if __name__ == '__main__':
    app.run(host='0.0.0.0', port=8080)

Knative Eventing

Knative Eventing enables event-driven architectures on Kubernetes. It allows services to communicate asynchronously by sending and receiving events, decoupling the event producers from consumers.

This is crucial for building reactive systems that respond to various changes, like data updates, file uploads, or scheduled tasks.

Eventing: Sources & Brokers

Key components in Knative Eventing:

  • Event Source: Generates events from various systems (e.g., Kafka, GitHub, CronJob, S3).
  • Broker: A central messaging hub where event sources send events. It abstracts the underlying messaging system.
  • Trigger: Filters events from a Broker based on attributes and routes them to a specific event consumer (often a Knative Service).

This flow enables flexible and scalable event processing.

Example Event Flow

Imagine you have a service that processes new images. You can set up an Event Source that monitors an S3 bucket for new image uploads.

When an image is uploaded, the source sends an event to a Broker. A Trigger, configured to filter for 'new S3 image' events, then forwards that event to your image processing Knative Service.

Your service processes the image, scales down when idle, and you only pay for the compute used during processing.

Knative Knowledge Check

Which Knative component is primarily responsible for automatically scaling services up or down based on incoming requests, including scaling to zero when idle?

Knative Recap

In this lesson, you explored how Knative brings serverless capabilities to Kubernetes. You learned about:

  • Knative Serving: For deploying and auto-scaling request-driven services.
  • Knative Eventing: For building event-driven architectures with sources, brokers, and triggers.

Knative empowers developers to build and run serverless applications with the control and flexibility of Kubernetes.

자주 묻는 질문

“Kubernetes를 활용한 서버리스(Knative)” 강의는 무료인가요?

네 — “Kubernetes를 활용한 서버리스(Knative)” 전체 내용을 이 웹사이트에서 무료로 읽을 수 있습니다. 인터랙티브하게 실습하려면(내장 코드 에디터와 24/7 AI 튜터), CoddyKit PRO로 업그레이드하면 Docker & Kubernetes for Developers 강의 전체를 잠금 해제할 수 있습니다. Docker & Kubernetes for Developers 강의에는 총 4개의 강의가 포함되어 있습니다.

“Kubernetes를 활용한 서버리스(Knative)”에서 뭘 배우나요?

Knative와 같은 플랫폼이 Kubernetes 위에서 서버리스 함수와 이벤트 기반 아키텍처를 구현하는 방식을 살펴봅니다. 브라우저에서 직접 실행하는 실습 코드로 Docker & Kubernetes for Developers을(를) 배우며, 24/7 AI 튜터가 강의를 진행하면서 질문에 답변해줍니다.

Docker & Kubernetes for Developers을(를) 시작하는 데 경험이 필요한가요?

사전 경험은 필요하지 않습니다. CoddyKit의 Docker & Kubernetes for Developers은(는) 초급자부터 고급 학습자까지를 위해 구성되어 있으므로, 여기서 시작하거나 처음부터 시작할 수 있으며 자신의 속도대로 진행할 수 있습니다. 이것은 4개 중 3번째 강의입니다.

“Kubernetes를 활용한 서버리스(Knative)” 강의는 얼마나 걸리나요?

대부분의 CoddyKit 강의는 약 5~10분이 소요됩니다. 각 강의는 간결하고 인터랙티브하여 꾸준한 진행이 가능하며, 웹과 앱에서 중단한 부분부터 바로 시작할 수 있습니다.

이 Docker & Kubernetes for Developers 강의에서 코드를 작성하고 실행할 수 있나요?

네. 모든 Docker & Kubernetes for Developers 강의에는 내장 코드 에디터가 포함되어 있으므로, 브라우저에서 바로 실제 코드를 작성하고 실행한 후 즉시 AI 피드백을 받을 수 있습니다 — 로컬 설정이 필요 없습니다.

이 강의의 모든 강의

  1. 사용자 지정 리소스 정의(CRD)
  2. Kubernetes의 오퍼레이터 패턴
  3. Kubernetes를 활용한 서버리스(Knative)
  4. Admission 웹훅으로 API 서버 확장하기
← Docker & Kubernetes for Developers(으)로 돌아가기