1、部署minio
kubectl apply -f - <<eof
apiVersion: apps/v1
kind: Deployment
metadata:
name: minio
namespace: spinnaker
spec:
selector:
matchLabels:
app: minio
replicas: 1
template:
metadata:
labels:
app: minio
spec:
containers:
- name: minio
imagePullPolicy: IfNotPresent
image: minio/minio:latest
args:
- "server"
- "/data"
- "--console-address"
- ":9001"
ports:
- containerPort: 9000
name: minio
- containerPort: 9001
name: console
volumeMounts:
- name: data
mountPath: /data
volumes:
- name: data
persistentVolumeClaim:
"minio.yaml" 84L, 1581C
nfs:
path: /data/nfs/
server: 10.0.7.11
---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: minio-pvc
namespace: spinnaker
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 50Gi
storageClassName: manual
---
apiVersion: v1
kind: Service
metadata:
name: minio
namespace: spinnaker
spec:
selector:
app: minio
ports:
- name: minio
port: 9000
targetPort: minio
nodePort: 30000 # 指定要使用的 NodePort 端口
- name: console
port: 9001
targetPort: console
nodePort: 30001
type: NodePort # 指定服务类型为 NodePort
[root@k8s-master01 spinnaker]# cat minio.yaml
apiVersion: apps/v1
kind: Deployment
metadata:
name: minio
namespace: spinnaker
spec:
selector:
matchLabels:
app: minio
replicas: 1
template:
metadata:
labels:
app: minio
spec:
containers:
- name: minio
imagePullPolicy: IfNotPresent
image: minio/minio:latest
args:
- "server"
- "/data"
- "--console-address"
- ":9001"
ports:
- containerPort: 9000
name: minio
- containerPort: 9001
name: console
volumeMounts:
- name: data
mountPath: /data
volumes:
- name: data
persistentVolumeClaim:
claimName: minio-pvc
---
kind: PersistentVolume
apiVersion: v1
metadata:
name: minio-pv
namespace: spinnaker
spec:
accessModes:
- ReadWriteOnce
capacity:
storage: 50Gi
persistentVolumeReclaimPolicy: Retain
storageClassName: manual
nfs:
path: /data/nfs/
server: 10.0.7.11
---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: minio-pvc
namespace: spinnaker
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 50Gi
storageClassName: manual
---
apiVersion: v1
kind: Service
metadata:
name: minio
namespace: spinnaker
spec:
selector:
app: minio
ports:
- name: minio
port: 9000
targetPort: minio
nodePort: 30000 # 指定要使用的 NodePort 端口
- name: console
port: 9001
targetPort: console
nodePort: 30001
type: NodePort # 指定服务类型为 NodePort
eof
浏览器访问:http://10.0.7.21:30001/dashboard
账户名:minioadmin
密码:minioadmin
创建桶->spinnaker(桶名)
创建用户(记住ak sk)->分配策略(ak有读写权限)
2、创建halyard容器修改配置
k8s管理机操作
mkdir /root/.hal
docker run -d -p 8084:8084 -p 9000:9000 \
--name halyard \
-v ~/.hal:/home/spinnaker/.hal \
-v ~/.kube:/home/spinnaker/.kube \
-it gcr.io/spinnaker-marketplace/halyard:1.32.0
docker exec -it -u root halyard bash
vi /opt/halyard/config/halyard.yml
spinnaker:
artifacts:
debian: https://dl.bintray.com/spinnaker-releases/debians
docker: gcr.io/spinnaker-marketplace
config:
input:
gcs:
enabled: false # true改为false,不自动拉配置
writerEnabled: false
bucket: halconfi
docker restart halyard
3、修改脚本部署
git clone https://github.com/zeyangli/spinnaker-cd-install
tar xf bom-yaml-1.19.4.tar.gz
mv .boms /root/.hal/
chmod -R 777 /root/.hal
chmod -R 777 /root/.kube
# 编辑拉镜像脚本
cd /root/spinnaker-cd-install/halyard-bom-install
vim install.sh # 修改这三行
DECK_HOST
GATE_HOST
NODES
# 执行拉镜像脚本
sh install.sh getimg
#编加了服务部署脚本
vim spinnaker-cd-install/halyard-bom-install/halyard.sh # 修改这五行
DECK
GATE
--endpoint http://xxxxx:9000 # minio的连接地址
--access-key-id xxx # minio的ak
--secret-access-key xxxx # minio的sk
docker cp spinnaker-cd-install/halyard-bom-install/halyard.sh halyard:/home/spinnaker
# 执行服务部署
docker exec -it halyard sh
cd /home/spinnaker
sh -x halyard.sh
#验证安装
kubectl get pods -n spinnaker