k8s配置拉取鏡像密鑰


一、部署步驟

1、創建阿里雲鏡像倉庫

2、創建Secret綁定鏡像倉庫賬號

3、創建Deployment綁定Secret

 

二、創建阿里雲鏡像倉庫

1、進入阿里雲容器鏡像服務,創建個人版實例

 

 2、設置登錄密碼后完成鏡像倉庫創建

 

 

三、創建Secret綁定鏡像倉庫賬號

[root@localhost ~]#  kubectl create secret docker-registry dockerhub --docker-server=registry.cn-hangzhou.aliyuncs.com --docker-username=XXX --docker-password=XXX --namespace=XXX

 

四、創建Deployment綁定Secret

[root@master ~]# cat >> /root/deployment.yaml <<EOF
apiVersion: apps/v1
kind: Deployment
metadata:
  name: hello-world
  namespace: kube-system
spec:
replicas: 1 selector: matchLabels: app: hello-world
strategy:
rollingUpdate:
maxSurge: 25%
maxUnavailable: 25%
type: RollingUpdate
template: metadata: labels: app: hello-world spec: imagePullSecrets: - name: dockerhub containers: - name: hello-world image: registry.cn-hangzhou.aliyuncs.com/test/hello-world:1d4ac56c-1 imagePullPolicy: IfNotPresent ports: - containerPort: 3003 name: http protocol: TCP livenessProbe: failureThreshold: 3 httpGet: path: / port: 3003 scheme: HTTP initialDelaySeconds: 120 periodSeconds: 10 successThreshold: 1 timeoutSeconds: 1 readinessProbe: failureThreshold: 3 httpGet: path: / port: 3003 scheme: HTTP initialDelaySeconds: 120 periodSeconds: 10 successThreshold: 1 timeoutSeconds: 1 resources: limits: memory: 1Gi requests: memory: 1Gi EOF

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM