原 kubernetes(k8s)第六部分之K8s部署dashboard
【1】通过search查找镜像并拉取镜像[root@random random]# docker search kubernetes-dashboard[root@random random]# docker pull siriuszg/kubernetes-dashboard-amd64【2】将镜像打包并通过scp发给master节点[root@random ~]# docker...
【1】通过search查找镜像并拉取镜像
[root@random random]# docker search kubernetes-dashboard
[root@random random]# docker pull siriuszg/kubernetes-dashboard-amd64
【2】将镜像打包并通过scp发给master节点
[root@random ~]# docker save -o kubernetes-dashboard-amd64.tar siriuszg/kubernetes-dashboard-amd64:latest
【3】在master节点加载镜像
[root@k8s-master ~]# docker load -i kubernetes-dashboard-amd64.tar
[root@k8s-master ~]# docker tag siriuszg/kubernetes-dashboard-amd64 registry:5000/kubernetes-dashboard-amd64
【4】将镜像上传到镜像仓库
[root@k8s-master ~]# docker push registry:5000/kubernetes-dashboard-amd64
【5】创建dashboard.yaml文件
[root@k8s-master ~]# cat dashboard.yaml
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
name: kubernetes-dashboard-latest
namespace: kube-system
spec:
replicas: 1
template:
metadata:
labels:
k8s-app: kubernetes-dashboard
version: latest
kubernetes.io/cluster-service: "true"
spec:
containers:
- name: kubernetes-dashboard
image: registry:5000/kubernetes-dashboard-amd64
resources:
limits:
cpu: 100m
memory: 50Mi
requests:
cpu: 100m
memory: 50Mi
ports:
- containerPort: 9090
args:
- --apiserver-host=http://172.25.37.11:8080
livenessProbe:
httpGet:
path: /
port: 9090
initialDelaySeconds: 30
timeoutSeconds: 30
【6】创建dashboardsvc.yaml文件
[root@k8s-master ~]# cat dashboardsvc.yaml
apiVersion: v1
kind: Service
metadata:
name: kubernetes-dashboard
namespace: kube-system
labels:
k8s-app: kubernetes-dashboard
kubernetes.io/cluster-service: "true"
spec:
selector:
k8s-app: kubernetes-dashboard
ports:
- port: 80
targetPort: 9090
【7】创建pod和service
[root@k8s-master ~]# kubectl create -f dashboard.yaml
[root@k8s-master ~]# kubectl create -f dashboardsvc.yaml
【8】查看dashboard部署情况
[root@k8s-master ~]# kubectl get svc --all-namespaces
[root@k8s-master ~]# kubectl get pod -o wide --all-namespaces
[root@k8s-master ~]# kubectl get deployment --all-namespaces
【9】执行下面的指令,让172.25.37.11可以通过172.25.37.11:8001/ui的方式访问dashboard
[root@k8s-master ~]# kubectl proxy --address=172.25.37.11 --disable-filter=true
【10】删除
[root@k8s-master ~]# kubectl delete svc kubernetes-dashboard --namespace=kube-systemservice "kubernetes-dashboard" deleted
[root@k8s-master ~]# kubectl delete deployment kubernetes-dashboard-latest --namespace=kube-systemdeployment "kubernetes-dashboard-latest" deleted
[root@k8s-master ~]#
---------------------
作者:random_w
来源:CSDN
原文:https://blog.csdn.net/random_w/article/details/80602258
版权声明:本文为博主原创文章,转载请附上博文链接!
更多推荐
所有评论(0)