赞
踩
修改jenkins-pvc.yaml
文件中的信息,然后应用YAML文件
cat > /opt/k8s/jenkins/jenkins-pvc.yaml <<EOF
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: jenkins-data-pvc
spec:
accessModes:
- ReadWriteMany
storageClassName: "nfs-storage"
resources:
requests:
storage: 5Gi
EOF
kubectl apply -f jenkins-pvc.yaml
kubectl get pvc
修改jenkins-Deployment.yaml
文件中的信息,然后应用YAML文件
cat > /opt/k8s/jenkins/jenkins-Deployment.yaml <<EOF apiVersion: apps/v1 kind: Deployment metadata: name: jenkins-deployment spec: replicas: 1 selector: matchLabels: app: jenkins template: metadata: labels: app: jenkins spec: containers: - name: jenkins image: jenkins/jenkins:2.451-jdk17 ports: - containerPort: 8080 volumeMounts: - name: jenkins-data mountPath: /jenkins volumes: - name: jenkins-data persistentVolumeClaim: claimName: jenkins-data-pvc EOF
kubectl apply -f jenkins-Deployment.yaml
kubectl get Deployment
修改jenkins-Service.yaml
文件中的信息,然后应用YAML文件
cat > /opt/k8s/jenkins/jenkins-Service.yaml <<EOF
apiVersion: v1
kind: Service
metadata:
name: jenkins-service
spec:
type: NodePort
ports:
- port: 8080
targetPort: 8080
nodePort: 30080
selector:
app: jenkins
EOF
kubectl apply -f jenkins-Service.yaml
kubectl get Service
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。