kubectl create secret docker-registry SECRET_NAME –namespace=NAME_SPACE \ –docker-server=DOCKER_REGISTRY_SERVER –docker-username=DOCKER_USER \ –docker-password=DOCKER_PASSWORD –docker-email=DOCKER_EMAIL
其中, docker-server 为通过docker login登陆时输入的地址 docker-username 为登陆时的账号 docker-password 为登陆时的密码 docker-email 为注册的账号时的邮箱地址
查看secret的内容: kubectl get secret harbor –namespace=common -o yaml
kubectl create -f frontend-controller.yaml
kubectl get pods –namespace=common kubectl describe pod frontend-cwfsm –namespace=common
1.FailedSync Error syncing pod, skipping: failed to “StartContainer” for “frontend” with ErrImagePull: “Error response from daemon: {\”message\”:\”Get https://server.com/v1/_ping: dial tcp: lookup harbor.itopka.com on 10.16.40.3:53: no such host\”}”
解决:在公网解析了域名的私网IP地址。
2.FailedSync Error syncing pod, skipping: failed to “StartContainer” for “frontend” with ErrImagePull: “Error response from daemon: {\”message\”:\”Get https://server.com/v1/_ping: dial tcp 192.168.1.132:443: getsockopt: connection refused\”}”
解决:在/etc/default/docker中添加: DOCKER_OPTS=”- -insecure-registry server.com”
ubuntu 15\16: vim /lib/systemd/system/docker.service ExecStart=/usr/bin/docker daemon -H fd:// –insecure-registry harbor.itopka.com
另外通过创建serviceAccount并引用的方式没有将pod运行起来,好不知道原因。提示: Failed to pull image “server.com/test/guestbook-php-frontend”: image pull failed for server.com/test/guestbook-php-frontend:latest, this may be because there are no credentials on this request. details: (Error: image test/guestbook-php-frontend:latest not found)