Confidential Space 이미지

Confidential Space 이미지는 컨피덴셜 VM 인스턴스에서 실행되는 최소한의 단일 목적 OS입니다. 영구 스토리지 없이 단일 워크로드를 한 번만 실행하도록 설계되었습니다. 이 워크로드는 Docker를 사용하여 Confidential Space 이미지 위에 레이어링됩니다.

Confidential Space 이미지는 Container-Optimized OS의 기존 보안 기능을 기반으로 하며 다음과 같은 이점을 제공합니다.

  • 무결성 보호가 적용된 암호화된 디스크 파티션

  • 인증되고 암호화된 네트워크 연결

  • 다양한 부팅 측정

  • 사용 중지된 원격 액세스 및 클라우드별 도구

이미지 유형

Confidential Space 이미지는 두 가지 형태로 제공됩니다.

  • 프로덕션: 프로덕션 이미지는 실제 프로덕션 데이터로 실제 프로덕션 워크로드를 실행하는 데 사용됩니다. 워크로드 운영자가 처리된 데이터에 액세스하지 못하도록 잠겨 있습니다. 자세한 내용은 Confidential Space 보안 개요를 참조하세요.

  • 디버그: 디버그 이미지는 비프로덕션 데이터에서 워크로드를 테스트하는 데 사용됩니다. 디버그 이미지에서 SSH가 사용 설정되고 운영자는 워크로드를 실행하는 VM에 대한 루트 액세스 권한을 갖습니다. 워크로드가 완료된 후 디버그 이미지를 실행하는 VM이 중지되지 않습니다.

워크로드를 배포할 때 사용할 이미지 유형을 설정할 수 있습니다.

Confidential Space 이미지 보기

다음 gcloud 명령어를 사용하여 사용 가능한 Confidential Space 이미지를 볼 수 있습니다.

gcloud compute images list \
    --project=confidential-space-images \
    --no-standard-images

다음 플래그는 결과에서 반환된 이미지를 변경할 수 있습니다.

  • --filter="family~'confidential-space$'" 플래그를 추가하여 프로덕션 이미지를 표시합니다.

  • --filter="family~'confidential-space-debug$'" 플래그를 추가하여 디버그 이미지를 표시합니다.

지원 중단된 이미지 보기

다음 명령어를 실행하여 지원 중단된 이미지를 결과에 포함하고 의사 결정에 도움이 되는 추가 필드를 포함합니다.

gcloud compute images list \
    --project=confidential-space-images \
    --no-standard-images \
    --show-deprecated \
    --filter="name ~ '^confidential-space-[0-9]{6}$'" \
    --format="table(
      name,
      creationTimestamp.date('%Y-%m-%d'):label=CREATION_DATE,
      status,
      description.sub('.*COS: ', '').sub(',.*', ''):label=COS_VERSION,
      deprecated.state:label=STATE,
      deprecated.deprecated:label=DEPRECATE_ON,
      deprecated.obsolete:label=OBSOLETE_ON,
      deprecated.replacement
    )"

성공적인 응답은 다음과 유사합니다.

NAME                       CREATION_DATE  STATUS  COS_VERSION               STATE       DEPRECATE_ON  OBSOLETE_ON  REPLACEMENT
confidential-space-230600  2023-06-09     READY   cos-dev-109-17637-0-0     DEPRECATED                             https://www.googleapis.com/compute/v1/projects/confidential-space-images/global/images/confidential-space-230901
confidential-space-230900  2023-09-17     READY   cos-dev-109-17637-0-0     DEPRECATED                             https://www.googleapis.com/compute/v1/projects/confidential-space-images/global/images/confidential-space-230600
confidential-space-230901  2023-10-02     READY   cos-dev-113-17877-0-0     DEPRECATED                             https://www.googleapis.com/compute/v1/projects/confidential-space-images/global/images/confidential-space-231001
confidential-space-231001  2023-11-01     READY   cos-dev-113-17965-0-0     DEPRECATED                             https://www.googleapis.com/compute/v1/projects/confidential-space-images/global/images/confidential-space-231100
confidential-space-231100  2023-11-17     READY   cos-dev-113-18026-0-0     DEPRECATED                             https://www.googleapis.com/compute/v1/projects/confidential-space-images/global/images/confidential-space-231200
confidential-space-231200  2023-12-04     READY   cos-dev-113-18054-0-0     DEPRECATED                             https://www.googleapis.com/compute/v1/projects/confidential-space-images/global/images/confidential-space-231201
confidential-space-231201  2023-12-15     READY   cos-dev-113-18059-0-0     DEPRECATED                             https://www.googleapis.com/compute/v1/projects/confidential-space-images/global/images/confidential-space-240200
confidential-space-240200  2024-02-28     READY   cos-dev-113-18146-0-0     DEPRECATED                             https://www.googleapis.com/compute/v1/projects/confidential-space-images/global/images/confidential-space-240402
confidential-space-240402  2024-04-22     READY   cos-dev-117-18342-0-0     DEPRECATED                             https://www.googleapis.com/compute/v1/projects/confidential-space-images/global/images/confidential-space-240500
confidential-space-240500  2024-05-30     READY   cos-dev-117-18374-0-0     DEPRECATED                             https://www.googleapis.com/compute/v1/projects/confidential-space-images/global/images/confidential-space-240700
confidential-space-240700  2024-07-30     READY   cos-113-18244-85-54       DEPRECATED                             https://www.googleapis.com/compute/v1/projects/confidential-space-images/global/images/confidential-space-240800
confidential-space-240800  2024-09-03     READY   cos-113-18244-151-14
confidential-space-240900  2024-10-01     READY   cos-113-18244-151-80
confidential-space-241000  2024-10-18     READY   cos-113-18244-151-96
...

Confidential Space 이미지 수명 주기

Confidential Space 이미지 계열을 사용하여 컨피덴셜 VM을 만들면 최신 버전의 Confidential Space 이미지가 사용됩니다. 워크로드가 완료된 후 항상 컨피덴셜 VM을 삭제하고 워크로드를 실행할 때마다 새 VM을 만든다면 이미지가 최신 상태로 유지되게 할 수 있습니다.

하지만 장기 실행 워크로드나 이전에 만든 VM에서 워크로드를 실행하면 오래된 Confidential Space 이미지를 사용할 위험이 있어 보안 취약점이 발생할 수 있습니다.

이를 완화하기 위해 데이터 공동작업자는 지원 속성을 사용하여 VM에서 실행되는 프로덕션 Confidential Space 이미지 버전이 최신인지 확인하고 통과하지 못하면 데이터에 대한 액세스를 거부할 수 있습니다. 디버그 Confidential Space 이미지에는 설정된 지원 속성이 없습니다.

다음 표에서는 프로덕션 Confidential Space 이미지에서 찾을 수 있는 지원 속성을 설명합니다.

지원 상태 속성 설명

LATEST

LATEST 이미지에는 다음과 같은 지원 상태 속성도 있습니다.

  • STABLE
  • USABLE

이미지 수명: 약 1개월 이후에는 LATEST 지원 상태 속성이 삭제됩니다.

최신 버전의 Confidential Space 이미지이며 지원이 제공되고 취약점이 모니터링됩니다.

장기 실행 워크로드의 경우 증명 정책의 일부로 LATEST를 지정하지 않는 것이 좋습니다. 워크로드가 실행되는 동안 Confidential Space 이미지가 업데이트되어 사용 중인 Confidential Space 이미지가 더 이상 LATEST가 아니게 되고 Confidential Space 기본 토큰이 다음에 새로고침될 때 워크로드 증명이 실패할 수 있기 때문입니다.

STABLE

STABLE 이미지에는 다음과 같은 지원 상태 속성도 있습니다.

  • USABLE

이미지 수명: 약 6개월 2027년 4월 1일부터 이미지 전체 기간이 만료되면 STABLE 지원 상태 속성이 삭제됩니다.

STABLE 속성이 있는 이미지는 6개월 동안 지원되고 취약점이 모니터링됩니다. STABLE 속성을 기반으로 증명 정책을 작성하는 것이 좋습니다.

드물지만 심각한 취약점이 발견되는 경우와 같이 일반적인 6개월 지원 기간에 STABLE 속성이 삭제될 수 있습니다.

USABLE

USABLE 속성만 있는 이미지는 계속 사용할 수 있지만 지원 중단된 것으로 간주됩니다. 지원 중단된 이미지는 지원되지 않으며 6개월이 지났습니다. 사용에 따른 책임은 사용자에게 있습니다.

USABLE 이미지에는 deprecated.deprecated 속성이 있습니다. 값은 이미지가 지원 중단될 것으로 예상되는 시점의 타임스탬프입니다. gcloud compute images describe 명령어 또는 images.get REST 메서드를 사용하여 이미지의 속성을 볼 수 있습니다. 예를 들면 다음과 같습니다.

gcloud compute images describe confidential-space-240800 \
    --format=json \
    --project=confidential-space-images
EXPERIMENTAL

이 속성만 있는 이미지는 프리뷰 기능을 사용합니다. EXPERIMENTAL 이미지는 테스트용으로만 사용되며 프로덕션에서 사용해서는 안 됩니다.

EXPERIMENTAL 이미지에는 LATEST, STABLE 또는 USABLE 속성이 없습니다.

Confidential Space 이미지를 최신 상태로 유지하는 것이 좋습니다. Confidential Space 이미지를 업데이트하는 방법은 Confidential Space 이미지 업데이트를 참조하세요.

지원 중단된 이미지 모니터링

지원 중단되었거나 곧 지원 중단될 예정인 Confidential Space 이미지를 실행하는 VM 인스턴스를 모니터링하려면 Cloud Scheduler 작업으로 정기적으로 실행되는 Cloud Run 함수를 배포하면 됩니다. 그런 다음 이미지가 지원 중단되면 알림을 받도록 Cloud Logging 알림을 설정할 수 있습니다.

Cloud Run 함수를 배포하여 지원 중단된 이미지 확인

Cloud Run 함수를 설정하려면 다음 안내를 완료하세요.

  1. Cloud Run에서 서비스 페이지로 이동합니다.

    서비스로 이동

  2. 함수 작성을 클릭합니다.

  3. 서비스 이름 상자에 함수의 이름을 입력합니다.

  4. 함수를 실행할 리전을 선택합니다.

  5. 런타임을 최신 버전의 Go로 설정합니다.

  6. 인증을 인증 필요로 설정합니다.

  7. 인그레스를 내부로 설정합니다.

  8. 컨테이너, 네트워킹, 보안 섹션을 펼칩니다.

  9. 컨테이너 탭에서 메모리를 128MiB로 설정합니다.

  10. 보안 탭에서 서비스 계정 상자를 클릭합니다.

  11. 새 서비스 계정 만들기를 클릭합니다.

  12. 서비스 계정 이름 상자에 이름을 입력합니다.

  13. 만들기를 클릭합니다.

  14. Compute 뷰어 역할을 추가한 후 완료를 클릭합니다.

  15. 만들기를 클릭합니다.

  16. 함수가 로드되면 소스 탭에서 함수 진입점을 DeprecationCheck로 설정합니다.

  17. function.go의 콘텐츠를 다음 코드로 덮어씁니다.

    // Package imagechecker provides a function to check for deprecated CS images.
    package imagechecker
    
    import (
    	"context"
    	"encoding/json"
    	"fmt"
    	"log"
    	"log/slog"
    	"net/http"
    	"regexp"
    	"strings"
    	"time"
    
    	"cloud.google.com/go/compute/metadata"
    	"google.golang.org/api/compute/v1"
    	"github.com/GoogleCloudPlatform/functions-framework-go/functions"
    )
    
    const (
    	sourceImageProject  = "confidential-space-images"
    	deprecationValueFmt = "2006-01-02"
    )
    
    // CS Images have the format confidential-space-.*.
    var prodImageNameRegex = regexp.MustCompile(`^confidential-space-.*`)
    
    // VMInfo represents the information logged about an VM instance of note.
    type VMInfo struct {
    	Name            string `json:"instance_name"`
    	Zone            string `json:"instance_zone"`
    	ImageName       string `json:"image_name"`
    	DeprecationDate string `json:"image_deprecation_date,omitempty"`
    	ObsoleteDate    string `json:"image_obsolete_date,omitempty"`
    }
    
    // VMList represents a list of notable VMs and their relevance.
    type VMList struct {
    	Description string   `json:"description"`
    	Instances   []VMInfo `json:"instances"`
    }
    
    // LogPayload is the payload for Cloud Logs written by this job.
    type LogPayload struct {
    	Message            string  `json:"message"`
    	Obsolete           *VMList `json:"vms_obsolete"`
    	ObsoleteWarning    *VMList `json:"vms_obsolete_warning"`
    	Deprecated         *VMList `json:"vms_deprecated"`
    	DeprecationWarning *VMList `json:"vms_deprecation_warning"`
    }
    
    // LogEntry represents a Cloud Logging entry.
    type LogEntry struct {
    	Message   string      `json:"message"`
    	Severity  string      `json:"severity"` // Special field for Cloud Logging.
    	Payload   *LogPayload `json:"payload,omitempty"`
    	ProjectID string      `json:"projectId"`
    }
    
    func init() {
    	log.SetFlags(0)
    	functions.HTTP("DeprecationCheck", checkForDeprecations)
    }
    
    func checkForDeprecations(w http.ResponseWriter, r *http.Request) {
    	ctx := context.Background()
    
    	// Retrieve project ID.
    	projectID, err := metadata.ProjectIDWithContext(ctx)
    	if err != nil {
    		errMsg := fmt.Sprintf("Failed to get project ID from metadata server: %v", err)
    		logError(projectID, errMsg)
    		http.Error(w, errMsg, http.StatusInternalServerError)
    		return
    	}
    	slog.Info(fmt.Sprintf("Checking for project: %s", projectID))
    
    	// Configure compute service.
    	computeService, err := compute.NewService(ctx)
    	if err != nil {
    		msg := fmt.Sprintf("Failed to create compute service: %v", err)
    		logError(projectID, msg)
    		http.Error(w, msg, http.StatusInternalServerError)
    		return
    	}
    
    	var obsoleteVMs []VMInfo           // Will contain VMs whose images are obsolete.
    	var obsoleteWarningVMs []VMInfo    // Will contain VMs using an image that will be obsolete within a month.
    	var deprecatedVMs []VMInfo         // Will contain VMs whose images are deprecated.
    	var deprecationWarningVMs []VMInfo // Will contain VMs using an image that will be deprecated within a month.
    	now := time.Now()
    
    	pageFunc := instancesPageFunc(ctx, projectID, &obsoleteVMs, &obsoleteWarningVMs, &deprecatedVMs, &deprecationWarningVMs, now, computeService)
    	if err = computeService.Instances.AggregatedList(projectID).Pages(ctx, pageFunc); err != nil {
    		msg := fmt.Sprintf("Failed to list instances: %v", err)
    		logError(projectID, msg)
    		http.Error(w, msg, http.StatusInternalServerError)
    		return
    	}
    
    	if len(obsoleteVMs) == 0 && len(obsoleteWarningVMs) == 0 && len(deprecatedVMs) == 0 && len(deprecationWarningVMs) == 0 {
    		returnmsg := "No VMs using obsolete or deprecated images found."
    		logEntry := LogEntry{
    			Message:   "Confidential Space Image Deprecation Alert - No Issues Detected",
    			Severity:  "INFO",
    			ProjectID: projectID,
    			Payload:   &LogPayload{Message: returnmsg},
    		}
    		writeLog(logEntry)
    
    		w.WriteHeader(http.StatusOK)
    		_, err := w.Write([]byte(returnmsg))
    		if err != nil {
    			http.Error(w, fmt.Sprintf("Failed to write HTTP response: %v", err), http.StatusInternalServerError)
    		}
    		return
    	}
    
    	respPayload := &LogPayload{
    		Message: "The following instances are using Confidential Space images that are obsolete, deprecated, or will be obsolete/deprecated soon. Obsolete and deprecated images are no longer maintained and scanned for vulnerabilities. Please review these instances and update their boot images as needed.",
    	}
    
    	if len(obsoleteVMs) > 0 {
    		respPayload.Obsolete = &VMList{
    			Description: "Instances using CS images that are obsolete.",
    			Instances:   obsoleteVMs,
    		}
    	}
    	if len(obsoleteWarningVMs) > 0 {
    		respPayload.ObsoleteWarning = &VMList{
    			Description: "Instances using CS images that will be obsolete within a month.",
    			Instances:   obsoleteWarningVMs,
    		}
    	}
    	if len(deprecatedVMs) > 0 {
    		respPayload.Deprecated = &VMList{
    			Description: "Instances using CS images that are deprecated.",
    			Instances:   deprecatedVMs,
    		}
    	}
    	if len(deprecationWarningVMs) > 0 {
    		respPayload.DeprecationWarning = &VMList{
    			Description: "Instances using CS images that will be deprecated within a month.",
    			Instances:   deprecationWarningVMs,
    		}
    	}
    
    	entry := LogEntry{
    		Message:   "Confidential Space Image Deprecation Alert",
    		Severity:  "WARNING",
    		ProjectID: projectID,
    		Payload:   respPayload,
    	}
    
    	writeLog(entry)
    
    	w.Header().Set("Content-Type", "application/json")
    	w.WriteHeader(http.StatusOK)
    	err = json.NewEncoder(w).Encode(respPayload)
    	if err != nil {
    		http.Error(w, fmt.Sprintf("Failed to write HTTP response: %v", err), http.StatusInternalServerError)
    		return
    	}
    }
    
    func instancesPageFunc(ctx context.Context, projectID string, obsoleteVMs *[]VMInfo, obsoleteWarningVMs *[]VMInfo, deprecatedVMs *[]VMInfo, deprecationWarningVMs *[]VMInfo, now time.Time, computeService *compute.Service) func(list *compute.InstanceAggregatedList) error {
    	return func(list *compute.InstanceAggregatedList) error {
    		for _, instanceList := range list.Items {
    			for _, instances := range instanceList.Instances {
    				sourceImage, err := getSourceImage(ctx, projectID, instances, computeService)
    				if err != nil {
    					slog.Warn(fmt.Sprintf("Failed to get source image for instance %s: %v", instances.Name, err))
    					continue
    				}
    
    				// Skip instance if not using a CS prod image.
    				imageProject, imageName := parseImage(sourceImage)
    				if imageProject != sourceImageProject || !prodImageNameRegex.MatchString(imageName) {
    					continue
    				}
    
    				// Get deprecation status ("deprecate-on" / "obsolete-on" / state settings).
    				depStatus, err := getDeprecationStatus(ctx, imageProject, imageName, computeService)
    				if err != nil {
    					slog.Error(fmt.Sprintf("Failed to get deprecation status for image %s in project %s: %v", imageName, imageProject, err))
    					continue
    				}
    				if depStatus == nil {
    					continue
    				}
    
    				vm := VMInfo{
    					Name:      instances.Name,
    					Zone:      getResourceName(instances.Zone),
    					ImageName: imageName,
    				}
    
    				var depTime, obsTime time.Time
    				if depStatus.Deprecated != "" {
    					depTime, err = parseDeprecationDate(depStatus.Deprecated)
    					if err != nil {
    						slog.Error(fmt.Sprintf("Failed to parse deprecation date %s for image %s in project %s: %v", depStatus.Deprecated, imageName, imageProject, err))
    						continue
    					}
    					vm.DeprecationDate = depTime.Format(deprecationValueFmt)
    				}
    
    				if depStatus.Obsolete != "" {
    					obsTime, err = parseDeprecationDate(depStatus.Obsolete)
    					if err != nil {
    						slog.Error(fmt.Sprintf("Failed to parse obsolete date %s for image %s in project %s: %v", depStatus.Obsolete, imageName, imageProject, err))
    						continue
    					}
    					vm.ObsoleteDate = obsTime.Format(deprecationValueFmt)
    				}
    
    				// Determine whether instance image is obsolete, upcoming obsolete, deprecated, or upcoming deprecated.
    				if depStatus.State == "OBSOLETE" || (!obsTime.IsZero() && isPast(obsTime, now)) {
    					*obsoleteVMs = append(*obsoleteVMs, vm)
    				} else if !obsTime.IsZero() && isWarning(obsTime, now) {
    					*obsoleteWarningVMs = append(*obsoleteWarningVMs, vm)
    				} else if depStatus.State == "DEPRECATED" || (!depTime.IsZero() && isPast(depTime, now)) {
    					*deprecatedVMs = append(*deprecatedVMs, vm)
    				} else if !depTime.IsZero() && isWarning(depTime, now) {
    					*deprecationWarningVMs = append(*deprecationWarningVMs, vm)
    				}
    			}
    		}
    
    		return nil
    	}
    }
    
    func getSourceImage(ctx context.Context, projectID string, instance *compute.Instance, service *compute.Service) (string, error) {
    	for _, disk := range instance.Disks {
    		// Only check boot disk.
    		if disk.Boot {
    			// Retrieve source image for disk.
    			diskName := getResourceName(disk.Source)
    			zone := getResourceName(instance.Zone)
    
    			d, err := service.Disks.Get(projectID, zone, diskName).Context(ctx).Do()
    			if err != nil {
    				slog.Warn(fmt.Sprintf("Failed to get details for disk %s in zone %s: %v", diskName, zone, err))
    				continue
    			}
    
    			if d.SourceImage != "" {
    				return d.SourceImage, nil
    			}
    		}
    	}
    
    	return "", fmt.Errorf("no suitable source image name found for instance %s", instance.Name)
    }
    
    func getDeprecationStatus(ctx context.Context, imageProject, imageName string, service *compute.Service) (*compute.DeprecationStatus, error) {
    	image, err := service.Images.Get(imageProject, imageName).Context(ctx).Do()
    	if err != nil {
    		slog.Warn(fmt.Sprintf("Failed to get details for image %s in project %s: %v", imageName, imageProject, err))
    		return nil, err
    	}
    
    	if image.Deprecated == nil || (image.Deprecated.Deprecated == "" && image.Deprecated.Obsolete == "" && image.Deprecated.State == "") {
    		// Skip if no deprecation/obsolete setting.
    		slog.Warn(fmt.Sprintf("Image %s in project %s has no deprecate-on or obsolete-on setting", imageName, imageProject))
    		return nil, nil
    	}
    
    	return image.Deprecated, nil
    }
    
    func parseDeprecationDate(dateStr string) (time.Time, error) {
    	formats := []string{
    		time.RFC3339,
    		time.RFC3339Nano,
    		"2006-01-02T15:04:05",
    		"2006-01-02",
    		"2006-01",
    	}
    	for _, format := range formats {
    		if t, err := time.Parse(format, dateStr); err == nil {
    			return t, nil
    		}
    	}
    	return time.Time{}, fmt.Errorf("unable to parse %q as a valid deprecation date", dateStr)
    }
    
    func isPast(obsTime time.Time, now time.Time) bool {
    	return !obsTime.After(now)
    }
    
    func isWarning(targetTime time.Time, now time.Time) bool {
    	warningWindowEnd := now.AddDate(0, 1, 0)
    	return targetTime.After(now) && !targetTime.After(warningWindowEnd)
    }
    
    func parseImage(image string) (string, string) {
    	parts := strings.Split(image, "/")
    
    	var project, imageName string
    	for i, part := range parts {
    		if part == "projects" && i+1 < len(parts) {
    			project = parts[i+1]
    		} else if part == "images" && i+1 < len(parts) {
    			imageName = parts[i+1]
    		}
    	}
    
    	slog.Info(fmt.Sprintf("Source image project: %s, name: %s", project, imageName))
    
    	return project, imageName
    }
    
    // getResourceName extracts the last part of a GCP resource URL.
    func getResourceName(url string) string {
    	parts := strings.Split(url, "/")
    	return parts[len(parts)-1]
    }
    
    func writeLog(entry LogEntry) {
    	jsonData, err := json.Marshal(entry)
    	if err != nil {
    		slog.Warn(fmt.Sprintf("Error marshaling final log: %v", err))
    		slog.Warn(fmt.Sprintf("Log contents: %v", entry))
    		return
    	}
    
    	fmt.Println(string(jsonData))
    }
    
    func logError(projectID, errMsg string) {
    	entry := LogEntry{
    		Message:   "Confidential Space Image Deprecation Alert - Job Failed",
    		Severity:  "ERROR",
    		ProjectID: projectID,
    		Payload: &LogPayload{
    			Message: errMsg,
    		},
    	}
    
    	writeLog(entry)
    }
    
    
  18. go.mod의 콘텐츠를 다음 코드로 덮어씁니다.

    module example.com/imagechecker
    
    require (
        cloud.google.com/go/compute/metadata v0.5.0
        github.com/GoogleCloudPlatform/functions-framework-go v1.9.0
        google.golang.org/api v0.264.0
    )
    
    
  19. 저장 및 재배포를 클릭합니다.

  20. 서비스가 성공적으로 배포되면 나중에 사용할 수 있도록 함수 이름 근처에 있는 URL을 기록해 둡니다.

Cloud Scheduler 작업 설정

Cloud Run 함수를 실행하는 Cloud Scheduler 작업을 설정하려면 다음 안내를 따르세요.

  1. 먼저 예약된 작업을 실행할 서비스 계정을 만듭니다. 이렇게 하려면 서비스 계정 만들기 페이지로 이동합니다.

    서비스 계정 만들기로 이동

  2. 서비스 계정 이름 상자에 서비스 계정 이름을 추가합니다.

  3. 나중에 사용할 수 있도록 서비스 계정 ID를 기록해 둡니다.

  4. 만들고 계속하기를 클릭합니다.

  5. Cloud Run 호출자 역할을 추가합니다.

  6. 완료를 클릭합니다.

  7. 아직 사용 설정하지 않았다면 Cloud Scheduler API를 사용 설정합니다.

  8. Cloud Scheduler에서 작업 페이지로 이동합니다.

    작업으로 이동

  9. 작업 만들기를 클릭합니다.

  10. 이름 필드에 작업 이름을 입력합니다.

  11. 예약된 작업을 실행할 리전을 선택합니다.

  12. 빈도 필드에 크론 일정을 추가합니다. 예를 들어 0 9 1 * *은 매월 1일 오전 9시에 작업을 실행합니다.

  13. 일정의 시간대를 설정합니다.

  14. 계속을 클릭합니다.

  15. 대상 유형을 HTTP로 설정합니다.

  16. URL을 만든 Cloud Run 함수의 URL로 설정합니다.

  17. 인증 헤더 상자에서 OIDC 토큰 추가를 선택합니다.

  18. 서비스 계정 상자를 클릭하고 이전에 만든 서비스 계정의 ID를 입력합니다.

  19. 생성한 Cloud Run 함수의 URL로 대상을 설정합니다.

  20. 만들기를 클릭합니다.

  21. 작업을 테스트하려면 작업을 클릭한 다음 강제 실행을 클릭합니다.

로그 기반 알림 설정

지원 중단된 이미지에 대한 로그 기반 알림을 설정하려면 다음 안내를 완료하세요.

  1. 로그 탐색기 페이지로 이동

    로그 탐색기로 이동

  2. 쿼리 표시를 사용 설정합니다.

  3. 쿼리 상자에 다음 Logging Query Language 쿼리 중 하나를 입력합니다.

    • 지원 중단 예정인 VM:

      resource.type="cloud_run_revision"
      severity="WARNING"
      jsonPayload.message="Confidential Space Image Deprecation Alert"
      
    • 지원 중단 확인 실패:

      resource.type="cloud_run_revision"
      severity="ERROR"
      jsonPayload.message="Confidential Space Image Deprecation Alert - Job Failed"
      
    • VM Fleet에서 지원 중단된 이미지가 감지되지 않음:

      resource.type="cloud_run_revision"
      severity="INFO"
      jsonPayload.message="Confidential Space Image Deprecation Alert - No Issues Detected"
      
  4. 쿼리 실행을 클릭합니다.

  5. 결과 옆에 있는 작업을 클릭합니다.

  6. 로그 알림 만들기를 클릭한 후 입력한 쿼리를 기반으로 알림 정책을 만드는 프로세스를 완료합니다.

Confidential Space 이미지 업데이트

Confidential Space 이미지를 최신 상태로 유지하고 중단을 방지하려면 Confidential Space 워크로드를 실행할 때마다 새 컨피덴셜 VM 인스턴스를 만드는 것이 좋습니다. Confidential Space 이미지를 기반으로 새 인스턴스를 만들 때마다 최신 Confidential Space 이미지가 프로비저닝됩니다.

각 컨피덴셜 스페이스 워크로드 실행에 대해 새 컨피덴셜 VM 인스턴스를 만들 수 없는 경우, 신뢰 당사자가 증명 정책에 설정한 지원 상태 속성을 기반으로 컨피덴셜 VM 인스턴스를 다시 만들 수 있도록 유지보수 기간을 정의하는 것이 좋습니다.

  • LATEST 지원 상태 속성이 필요한 증명 정책을 설정한 경우 최소 한 달에 한 번 Confidential Space 이미지를 업데이트해야 합니다.

  • STABLE 지원 상태 속성이 필요한 증명 정책을 설정한 경우 최소 6개월마다 Confidential Space 이미지를 업데이트해야 합니다.

다음 중 하나 이상을 사용하여 VM을 더 쉽게 다시 만들 수 있습니다.

이러한 기능을 설정하는 방법은 자동 확장, 자동 복구, 이미지 업데이트를 사용하여 MIG로 Confidential Space 워크로드 배포를 참조하세요.

장기 실행 워크로드

장기 실행 워크로드 중에 Confidential Space 이미지가 지원 중단되거나 취소될 수 있습니다. STABLE Confidential Space 지원 상태 속성을 요구하도록 증명 정책을 설정했고 워크로드에서 사용하는 Confidential Space 이미지가 지원 중단되거나 취소된 경우 워크로드를 실행하는 컨피덴셜 VM 인스턴스가 증명을 통과하지 못합니다. 중단을 방지하려면 장기 실행 워크로드는 재개를 염두에 두고 설계해야 하며 상태를 안전하게 관리해야 합니다.