自动同步
在前面我们使用了手动同步 https://www.cnblogs.com/zouzou-busy/p/16600104.html,当 git 仓库有变更时,需要手动点击 SYNC
,比较麻烦,我们也可以创建一个自动同步的应用,如下
点击 CREATE
创建应用,当我们点击之后就自动同步了
等会在查看,状态变为正常了
查看 svc、pod、deployment
# 查看 pod,svc,deploy,都正常
[root@master1 k8s-yaml]# kubectl get pod,svc,deploy -n demo4
NAME READY STATUS RESTARTS AGE
pod/myapp-77c6b7455d-7n59v 1/1 Running 0 103s
pod/myapp-77c6b7455d-sljvb 1/1 Running 0 103s
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
service/myapp NodePort 10.97.157.98 <none> 8008:31921/TCP 105s
NAME READY UP-TO-DATE AVAILABLE AGE
deployment.apps/myapp 2/2 2 2 105s
访问 31291 端口,页面如下则部署成功
自动更新应用
接下来我们把镜像改为 v3 版本,查看
myapp-deployment.yaml
apiVersion: apps/v1
kind: Deployment
metadata:
name: myapp
spec:
replicas: 2
selector:
matchLabels:
app: myapp
template:
metadata:
labels:
app: myapp
spec:
containers:
- image: zouzou0214/myapp:v3 # 更改为 v3 版本的镜像
name: myapp
ports:
- containerPort: 8008
等会查看,应用 app04 自动发布了
发布成功后,查看 pod、svc、deployment
# 查看 pod,svc,deploy
[root@master1 k8s-yaml]# kubectl get pod,svc,deploy -n demo4
NAME READY STATUS RESTARTS AGE
pod/myapp-5fc675cb77-czsnz 1/1 Running 0 2m27s
pod/myapp-5fc675cb77-dxsrc 1/1 Running 0 3m42s
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
service/myapp NodePort 10.97.157.98 <none> 8008:31921/TCP 9m17s
NAME READY UP-TO-DATE AVAILABLE AGE
deployment.apps/myapp 2/2 2 2 9m17s
在放心 31291 端口,可以看到,变成了 v3 版本
标签:原生,NAME,--,AGE,argocd,svc,myapp,deployment,pod From: https://www.cnblogs.com/zouzou-busy/p/16600505.html