If you have multiple Container Service for Kubernetes (ACK) clusters deployed in regions
within your account, you can use Application Center to deploy an application to these
clusters at a time. This topic describes how to use an orchestration template to deploy
an application to two ACK clusters in different regions at a time.
Procedure
- Log on to the ACK console.
- In the left-side navigation pane of the ACK console, choose .
- On the application center page, click create application.
- Configure parameters on the application source configuration wizard page.
- In the install application publishing components area, select cluster, and then click Start installation.
Note This step is required only for the first installation of the app.
- In the application source area, click yaml template.
- click next.
- Set parameters in the application configuration wizard page.
- Set the app name and app description.
- To set a template, you can select an existing template or a new template. This article
takes the new template as an example.
- Click the new template tab, and then click Add through yaml in the upper right corner.
- Copy the following into the text box and click OK.
This paper takes the demo application of red version as an example.
apiVersion: apps/v1
kind: Deployment
metadata:
name: demo
labels:
app: demo
spec:
minReadySeconds: 5
revisionHistoryLimit: 5
progressDeadlineSeconds: 60
strategy:
rollingUpdate:
maxUnavailable: 1
type: RollingUpdate
selector:
matchLabels:
app: demo
template:
metadata:
annotations:
prometheus.io/scrape: "true"
prometheus.io/port: "9797"
labels:
app: demo
spec:
containers:
- name: demo
image: registry.cn-hangzhou.aliyuncs.com/acs/rollouts-demo:red
imagePullPolicy: IfNotPresent
ports:
- name: http
containerPort: 8080
protocol: TCP
readinessProbe:
tcpSocket:
port: 8080
initialDelaySeconds: 5
timeoutSeconds: 5
resources:
limits:
cpu: 2000m
memory: 512Mi
requests:
cpu: 100m
memory: 64Mi
---
apiVersion: v1
kind: Service
metadata:
name: demo-svc
spec:
selector:
app: demo
ports:
- protocol: TCP
port: 80
targetPort: 8080
---
apiVersion: extensions/v1beta1
kind: Ingress
metadata:
name: demo
labels:
app: demo
spec:
rules:
- host: app.demo.example.com
http:
paths:
- backend:
serviceName: demo-svc
servicePort: 80
- Click next.
- In the Release Configurations step, set the parameters.
- In the Release Configurations section, set the release type. You can select Full Release or Canary Release.
If this is the initial release of the application, you can select only Full Release.
You can select Canary Release when you update the application.
- In the Select Cluster section, click Add to the left side of the two clusters that you created. The added clusters appear
in the Cluster section. Then, select the namespace where you want to deploy the new application version.
Note Clusters of all regions within your account are displayed in the Select Cluster section.
- Click Release Now.
- Click OK in the publish confirmation dialog box.
You can see the progress of publishing applications in the publishing log configuration page.
- Click finish on the publish log configuration wizard page.
Verify the result
- Obtain the endpoint of the application.
- Log on to the ACK console.
- In the left-side navigation pane of the ACK console, click Clusters.
- On the Clusters page, find the cluster that you want to manage and click the name of the cluster
or click Details in the Actions column. The details page of the cluster appears.
- In the left-side navigation pane of the details page, choose .
- On the Ingresses, check the endpoint of the Ingress created for the demo application.
- Add the following content to the hosts file:
<Endpoint> app.demo.example.com
- Enter app.demo.example.com in the address bar of your browser and press Enter.
If the page appears as shown in the following figure, it indicates that the application
is deployed.
- Delete the endpoint obtained in Step 1 from the hosts file. Then, obtain the endpoint for the application deployed in the other cluster
and perform Step 2 and Step 3 again to access the application. If the page appears as shown in the following figure,
it indicates that the application is also deployed.