Spinnaker部署并实现CD

Posted wshile

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Spinnaker部署并实现CD相关的知识,希望对你有一定的参考价值。

Spinnaker

概述

部署

交付minio

1. harbor上创建armory私有仓库

1 docker pull minio/minio:latest
2 docker tag 703bd3096c96 harbor.od.com/armory/minio:latest
3 docker push harbor.od.com/armory/minio:latest

2. 创建k8s集群secret资源

1 kubectl create ns armory
2 kubectl create secret docker-registry harbor --docker-server=harbor.od.com --docker-username=admin --docker-password=1 -n armory

3. 准备资源配置清单

mkdir /data/k8s-yaml/minio
mkdir /data/nfs-volume/minio
cd /data/nfs-volume/minio
vi dp.yaml

kind: Deployment
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
  labels:
    name: minio
  name: minio
  namespace: armory
spec:
  progressDeadlineSeconds: 600
  replicas: 1
  revisionHistoryLimit: 7
  selector:
    matchLabels:
      name: minio
  template:
    metadata:
      labels:
        app: minio
        name: minio
    spec:
      containers:
      - name: minio
        image: harbor.od.com/armory/minio:latest
        imagePullPolicy: IfNotPresent
        ports:
        - containerPort: 9000
          protocol: TCP
        args:
        - server
        - /data
        env:
        - name: MINIO_ACCESS_KEY
          value: admin
        - name: MINIO_SECRET_KEY
          value: admin123
        readinessProbe:
          failureThreshold: 3
          httpGet:
            path: /minio/health/ready
            port: 9000
            scheme: HTTP
          initialDelaySeconds: 10
          periodSeconds: 10
          successThreshold: 1
          timeoutSeconds: 5
        volumeMounts:
        - mountPath: /data
          name: data
      imagePullSecrets:
      - name: harbor
      volumes:
      - nfs:
          server: ecs182-149
          path: /data/nfs-volume/minio
        name: data
vi svc.yaml

apiVersion: v1
kind: Service
metadata:
  name: minio
  namespace: armory
spec:
  ports:
  - port: 80
    protocol: TCP
    targetPort: 9000
  selector:
    app: minio
vi ingress.yaml

kind: Ingress
apiVersion: extensions/v1beta1
metadata: 
  name: minio
  namespace: armory
spec:
  rules:
  - host: minio.od.com
    http:
      paths:
      - path: /
        backend: 
          serviceName: minio
          servicePort: 80

4. 内网配置bind地址解析

minio              A    172.26.28.194
systemctl restart named

 交付缓存redis

1. 下载镜像

1 docker pull redis:4.0.14
2 docker tag f54239c50400 harbor.od.com/armory/redis:v4.0.14
3 docker push harbor.od.com/armory/redis:v4.0.14

2. 创建目录,准备资源配置清单

mkdir /data/k8s-yaml/redis
cd /data/k8s-yaml/redis/
 1 vi dp.yaml
 2 
 3 kind: Deployment
 4 apiVersion: extensions/v1beta1
 5 kind: Deployment
 6 metadata:
 7   labels:
 8     name: redis
 9   name: redis
10   namespace: armory
11 spec:
12   replicas: 1
13   revisionHistoryLimit: 7
14   selector:
15     matchLabels:
16       name: redis
17   template:
18     metadata:
19       labels:
20         app: redis
21         name: redis
22     spec:
23       nodeName: ecs28-201.host.name
24       containers:
25       - name: redis
26         image: harbor.od.com/armory/redis:v4.0.14
27         imagePullPolicy: IfNotPresent
28         ports:
29         - containerPort: 6379
30           protocol: TCP
31       imagePullSecrets:
32       - name: harbor
 1 # 创建service的原因是通过k8s集群内部使用service名字连接redis服务
 2 vi svc.yaml
 3 
 4 apiVersion: v1
 5 kind: Service
 6 metadata:
 7   name: redis
 8   namespace: armory
 9 spec:
10   ports:
11   - port: 6379
12     protocol: TCP
13     targetPort: 6379
14   selector:
15     app: redis

 

以上是关于Spinnaker部署并实现CD的主要内容,如果未能解决你的问题,请参考以下文章

kubernetes 基于jenkins spinnaker的ci/cd实践二sonarqube

kubernetes 基于jenkins spinnaker的ci/cd实践二sonarqube

kubernetes 基于jenkins spinnaker的ci/cd实践一增加制品镜像扫描

kubernetes 基于jenkins spinnaker的ci/cd实践一增加制品镜像扫描

kubernetes 基于jenkins spinnaker的ci/cd实践一增加制品镜像扫描

Spinnaker:云原生多云环境持续部署的未来