You can view the deployment progress and changes of all Kubernetes resources when
you deploy an application in the Application Center module of the Container Service
for Kubernetes (ACK) console. You can choose different methods to deploy applications
based on the data sources of the templates. This topic describes how to create an
application from an orchestration template in Application Center.
Procedure
- Log on to the ACK console.
- Authorize the cluster to manage orchestration templates.
- 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.
- On the Cluster Information page, click the Cluster Resources tab.
- On the Cluster Resources tab, click KubernetesWorkerRole-**** to the right of Worker RAM Role.
- On the KubernetesWorkerRole-**** page, click the Permissions tab and then click the policy name of k8sWorkerRolePolicy-****.
- On the policy details page, click the Policy Document tab and click Modify Policy Document.
- In the Modify Policy Document panel, add the following code block and click OK.
{
"Action": [
"cs:CreateTemplate",
"cs:DescribeTemplates",
"cs:DescribeTemplateAttribute",
"cs:UpdateTemplate",
"cs:DeleteTemplate"
],
"Resource": [
"*"
],
"Effect": "Allow"
}
- In the upper-left corner of the ACK console, click the
icon to the left of the cluster name.
- In the left-side navigation pane of the ACK console, choose .
- On the Application Center page, click Create Application.
- On the Source wizard page, set the parameters.
- In the Install appcenter section, select the cluster where you want to install appcenter and click Install.
Note This step is required only when you use Application Center to create applications
for the first time.
- In the Source section, click YAML Template.
- Click Next.
- On the Application Configurations wizard page, set the parameters.
- Set Name and Description.
- Specify a template for the application. You can select an existing template or create
a template. In this topic, a template is created.
- Click the Create Template tab and then click Create with YAML in the upper-right corner of the tab.
- Copy the following code into the Create panel and click OK.
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: networking.k8s.io/v1
kind: Ingress
metadata:
name: demo
labels:
app: demo
spec:
rules:
- host: app.demo.example.com
http:
paths:
- path: /
pathType: Prefix
backend:
service:
name: demo-svc
port:
number: 80
- Click Next.
- On the Release Configurations wizard page, set the parameters.
- In the Release Configurations section, select the release type. Full Release and Canary Release are supported.
Note If this is the initial release of the application, you can select only Full Release. You can select Full Release or Canary Release when you update the application.
- In the Select Cluster section, click Add to the left side of the cluster that you want to select. The added cluster appears
in the Cluster section. Then, select the namespace where you want to deploy the new application version in the Cluster section.
- Click Release Now.
- In the Confirm Release message, click OK.
In the Release Log step, you can view the deployment progress.
- In the Release Log step, click Complete.
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 page, 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.
