Serverless App Engine (SAE) ile ana uygulama konteynerinin işlevselliğini geliştirmek üzere bir uygulamaya sidecar konteyner ekleyebilirsiniz. Sidecar konteyner, izleme ve günlük toplama gibi iş dışı işlevlerin ayrıştırılmasına ve standartlaştırılmasına yardımcı olur. Bu yaklaşım, yardımcı görevleri ana uygulama konteynerinden ayırarak ana konteynerin temel iş mantığına odaklanmasını sağlar.
Giriş noktaları
-
Uygulama oluşturma
On the SAE Application List sayfasında, üst gezinme çubuğundan hedef bölge ve ad alanını seçin ve ardından Create Application öğesini tıklayın. On the Application Basic Information sayfasında parametreleri yapılandırın ve Next: Advanced Settings öğesini tıklayın.
Çalışan bir uygulamayı değiştirme
UyarıBir uygulamayı yeniden dağıttığınızda uygulama yeniden başlatılır. İş kesintisi gibi öngörülemeyen hataları önlemek için uygulamaları yoğun olmayan saatlerde dağıtmanızı öneririz.
On the SAE Application List sayfasında, üst gezinme çubuğundan hedef bölge ve ad alanını seçin. Hedef Application ID'sini tıklayarak uygulama ayrıntıları sayfasını açın. In the navigation pane on the left, click Basic Information. In the upper-right corner, click Deploy Application.
Durdurulmuş bir uygulamayı değiştirme
On the SAE Application List sayfasında, üst gezinme çubuğundan hedef bölge ve ad alanını seçin. Hedef Application ID'sini tıklayarak uygulama ayrıntıları sayfasını açın. Click Basic Information, and then click Modify Application Configuration.
Find and expand the Add a sidecar container. bölümünü bulun ve genişletin, ardından Add öğesini tıklayın.
Yapılandırma
In the Sidecar container panelinde aşağıdaki parametreleri yapılandırın ve OK öğesini tıklayın.
Enter a custom Container name.
-
Based on the image source for your sidecar, select either Images of Current Alibaba Cloud Account or Custom Image:
-
Images of Current Alibaba Cloud Account: Pull an image from the Container Registry (ACR) repository in the current account. You can use either Container Registry Personal Edition or Container Registry Enterprise Edition.
Prerequisites: You have created an image and pushed it to an ACR image repository in the current account. For more information, see Görüntü oluşturma örnekleri, Enterprise Edition örneklerini kullanarak görüntü oluşturma veya Personal Edition örneklerini kullanarak görüntü gönderme ve çekme.
-
Container Registry Personal Edition: Specify the sidecar image by selecting an Image Repository Namespace, an Image Repository Name, and an Image Version.
Örneğin, görüntü depo ad alanını demo, görüntü depo adını nginx ve görüntü etiketini latest olarak ayarlayın.
Container Registry Enterprise Edition: Specify the sidecar image by selecting an instance from the Enterprise Edition Instances list, and then selecting an Image Repository Namespace, an Image Repository Name, and an Image Version.
-
-
Custom Image: Pull an image from a private image repository in another Alibaba Cloud account or a third-party image repository.
-
Başka bir Alibaba Cloud hesabındaki özel görüntü deposu:
If the main application container pulls its image from an ACR repository in another Alibaba Cloud account, the sidecar container can also pull an image from the same repository. SAE automatically reuses the
acrAssumeRoleArnandsecretconfigured for the main application container.You must enter the full Image address. The format is
<image repository address>:<image tag>. For example:registry.cn-beijing.aliyuncs.com/sae-demo-******:nginx. -
Üçüncü taraf görüntü deposu:
To pull an image from a third-party image repository such as Docker Hub, Harbor, or GitHub Container Registry, ensure that the image repository address is accessible from the public internet.
You must enter the full Image address. The format is
<image name>:<image tag>. For example:registry.openanolis.cn/******/nginx:1.14.1-8.6.ÖnemliBy default, SAE applications cannot access the public internet and therefore cannot pull images from public repositories. To enable this access, you must configure a NAT Gateway for your application's Virtual Private Cloud (VPC). For more information, see SAE uygulamaları için genel ağ erişimini etkinleştirmek üzere NAT Gateway yapılandırma.
-
-
-
Set the Maximum number of CPU resources and Maximum number of memory resources for the Sidecar container.
NotThe sidecar container shares CPU and memory resources with the main application container. To ensure the main application container functions properly, set reasonable resource limits for the sidecar container to prevent it from consuming excessive resources.
-
(İsteğe bağlı) Click Advanced Settings to configure the following parameters for the sidecar container.
In the Startup Command section, configure a startup command for the sidecar container. For more information, see Başlangıç komutu ayarlama.
In the Environment Variable section, configure environment variables for the sidecar container. For more information, see Ortam değişkenlerini ayarlama.
In the Configuration Management section, inject required configuration into the sidecar container by mounting a ConfigMap. For more information, see Yapılandırmaları enjekte etme.
-
In the Share temporary storage section, create and mount a temporary storage directory to both the main application container and the sidecar container.
Enter a Temporary Storage Name and a Container Path.
NotThe temporary storage name can contain only lowercase letters, digits, and hyphens (-).
Dağıtım doğrulaması
-
On the sayfasında hem ana uygulama konteynerinin hem de sidecar konteynerinin gerçek zamanlı günlüklerini görüntüleyin.
Sayfanın üst kısmındaki Container açılır listesinden Sidecar container sidecar-nginx öğesini seçerek ilgili gerçek zamanlı günlükleri görüntüleyin.
-
On the Instances sayfasında bir örnekte oturum açmak için Webshell kullanın. Webshell sayfası hem ana uygulama konteynerinin hem de sidecar konteynerinin ayrıntılarını gösterir.
Use the drop-down list at the top to switch between the Main application container and the Sidecar container sidecar-nginx.
In the
/tmpdirectory of the main application container and the sidecar container, check for atestdizini olup olmadığını kontrol edin.