k8s配置拉取镜像密钥

一、部署步骤

1、创建阿里云镜像仓库

2、创建Secret绑定镜像仓库账号

3、创建Deployment绑定Secret

 

二、创建阿里云镜像仓库

1、进入阿里云容器镜像服务,创建个人版实例

k8s配置拉取镜像密钥

 

 2、设置登录密码后完成镜像仓库创建

k8s配置拉取镜像密钥

 

 

三、创建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

 

上一篇:使用request爬取豆瓣


下一篇:Day01