复制 docker login -u < usernam e > -p < passwor d > < registry-add r >
复制 docker pull https://registry.xxx.com/dev/nginx:latest
复制 docker push https://registry.xxx.com/dev/nginx:latest
复制 docker tag < old-imag e > < new-imag e >
2.1. 所有节点配置insecure-registries
复制 #cat /etc/docker/daemon.json
{
"data-root" : "/data/docker" ,
"debug" : false ,
"insecure-registries" : [
...
"docker.xxx.com:8080"
],
...
}
2.2. 所有节点配置/var/lib/kubelet/config.json
复制 #cat ~/.docker/config.json
{
"auths": {
"docker.xxx.com:8080": {
"auth": "<此处为凭证信息>"
}
},
"HttpHeaders": {
"User-Agent": "Docker-Client/18.09.9 (linux)"
}
}
复制 # 获取所有节点的IP
nodes = $( kubectl get nodes -o jsonpath= '{range .items[*].status.addresses[?(@.type=="ExternalIP")]}{.address} {end}' )
# 拷贝到所有节点
for n in $nodes; do scp ~/.docker/config.json root@ $n :/var/lib/kubelet/config.json ; done
复制 apiVersion : apps/v1beta2
kind : Deployment
metadata :
annotations :
deployment.kubernetes.io/revision : "1"
generation : 1
labels :
k8s-app : dockeroa-hub
qcloud-app : dockeroa-hub
name : dockeroa-hub
namespace : test
spec :
progressDeadlineSeconds : 600
replicas : 3
revisionHistoryLimit : 10
selector :
matchLabels :
k8s-app : dockeroa-hub
qcloud-app : dockeroa-hub
strategy :
rollingUpdate :
maxSurge : 25%
maxUnavailable : 25%
type : RollingUpdate
template :
metadata :
labels :
k8s-app : dockeroa-hub
qcloud-app : dockeroa-hub
spec :
containers :
- image : docker.xxx.com:8080/public/2048:latest
imagePullPolicy : Always
name : game
resources :
limits :
cpu : 500m
memory : 1Gi
requests :
cpu : 250m
memory : 256Mi
terminationMessagePath : /dev/termination-log
terminationMessagePolicy : File
dnsPolicy : ClusterFirst
restartPolicy : Always
nodeName : 192.168.1.1
schedulerName : default-scheduler
securityContext : {}
terminationGracePeriodSeconds : 30
复制 #kgpoowide -n game
NAME READY STATUS RESTARTS AGE IP NODE NOMINATED NODE READINESS GATES
docker-oa-757bbbddb5-h6j7m 1/1 Running 0 14m 192.168.2.51 192.168.1.1 < non e > < non e >
docker-oa-757bbbddb5-jp5dw 1/1 Running 0 14m 192.168.1.32 192.168.1.2 < non e > < non e >
docker-oa-757bbbddb5-nlw9f 1/1 Running 0 14m 192.168.0.43 192.168.1.3 < non e > < non e >