整体流程
1.Github新建一个项目
2.提交一个index.html,Dockerfile 和 deploymen.yaml文件
3.云效构建流程(拉代码,运行Dockerfile文件,打包镜像,上传镜像,执行deployment文件)




根据自己节点区域选择,仓库没有可以新建

构建标签说明:

具体其他细节可参考官网:
https://thoughts.aliyun.com/sharespace/5e86a419546fd9001aee81f2/docs/5e8c438e546fd9001aee824b
发布到k8s集群,集群连接这里下拉会自动弹出(确保已有集群)

YAML路径就是之前上传的deployment.yaml
参数就是自动构建的参数
最后保存运行

点击进去可以看具体日志


附带仓库中的代码
Dockerfile
FROM nginx:alpine
COPY ./index.html /usr/share/nginx/html
CMD ["nginx","-g","daemon off;"]
Deployment.yaml
kind: Service
apiVersion: v1
metadata:
name: nginx-ppline
spec:
selector:
app: nginx-ppline
type: ClusterIP
ports:
- protocol: TCP
port: 80
targetPort: 80
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: nginx-ppline
labels:
app: nginx-ppline
spec:
replicas: 3
selector:
matchLabels:
app: nginx-ppline
template:
metadata:
labels:
app: nginx-ppline
spec:
imagePullSecrets:
- name: registry-secret
containers:
- name: nginx-ppline
image: ${version}
ports:
- containerPort: 80
注意image:${version}和流程写的对应
看一下镜像仓库

需要回滚操作如下

网友评论