/**
個人學習筆記,如有問題歡迎交流,文章編排和格式等問題見諒!
*/
(1)編寫 pod.yaml?文件
pod 是 kubernetes 中最小的編排單位,一個 pod 里包含一個或多個容器。
apiVersion: v1 # 指定api版本
kind: Pod # kind: string類型,指定資源類型,例如Pod,Deployment,Service等
metadata: #資源的元數據/屬性name: nginx #資源的名字,在同一個namespace中必須唯一labels: #設定資源的標簽,詳情請見http://blog.csdn.net/liyingke112/article/details/77482384app: nginx
spec:containers:- name: nginximage: nginx:alpine # 指定鏡像ports: # 指定暴露端口- containerPort: 80
(2)部署 pod
kubectl apply -f pod.yaml
(3)查看 pod 情況
kubectl get pods
kubectl get pods -o wide
kubectl describe pod nginx
(4)刪除 pod
kubectl delete -f pod.yaml
docker 配置鏡像源:
# 創建或修改 /etc/docker/daemon.json 文件,修改為如下形式
{"registry-mirrors" : ["https://registry.docker-cn.com","https://docker.mirrors.ustc.edu.cn","http://hub-mirror.c.163.com","https://cr.console.aliyun.com/"]
}
# 重啟docker服務使配置生效
$ systemctl restart docker.service
錯誤:
[node@k8s-node-2 ~]$ sudo docker pull registry.access.redhat.com/rhel7/pod-infrastructure:latest
Trying to pull repository registry.access.redhat.com/rhel7/pod-infrastructure ...
open /etc/docker/certs.d/registry.access.redhat.com/redhat-ca.crt: no such file or directory
解決方法:
創建一個空白的缺少的文件即可。
如果還有錯誤,嘗試執行如下命令:
yum install *rhsm* -y
參考鏈接:
https://www.cnblogs.com/lp19910807/p/10529746.html
docker國內鏡像源_docker鏡像源_zlzhaoe的博客-CSDN博客?