一、部署步骤
1、进入阿里云容器镜像服务,创建个人版实例
2、设置登录密码后完成镜像仓库创建
[root@localhost ~]# kubectl create secret docker-registry dockerhub --docker-server=registry.cn-hangzhou.aliyuncs.com --docker-username=XXX --docker-password=XXX --namespace=XXX
[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