Kubernetes-dashboard部署

2019-10-18 01:42:50 浏览数 (1)

下载镜像

代码语言:javascript复制
docker pull registry.cn-beijing.aliyuncs.com/kubernetesdevops/kubernetes-dashboard-amd64:v1.10.0
docker tag registry.cn-beijing.aliyuncs.com/kubernetesdevops/kubernetes-dashboard-amd64:v1.10.0  k8s.gcr.io/kubernetes-dashboard-amd64:v1.10.0

部署应用

代码语言:javascript复制
kubectl apply -f https://raw.githubusercontent.com/kubernetes/dashboard/v1.10.1/src/deploy/recommended/kubernetes-dashboard.yaml

控制台文件修改更改如下

代码语言:javascript复制
kind: Service
apiVersion: v1
metadata:
labels:
k8s-app: kubernetes-dashboard
name: kubernetes-dashboard
namespace: kube-system
spec:
ports:
- port: 443
targetPort: 8443
      nodePort: 31234
selector:
k8s-app: kubernetes-dashboard
  type: NodePort

创建admin用户token

代码语言:javascript复制
kind: ClusterRoleBinding
apiVersion: rbac.authorization.k8s.io/v1beta1
metadata:
  name: admin
  annotations:
    rbac.authorization.kubernetes.io/autoupdate: "true"
roleRef:
  kind: ClusterRole 
  name: cluster-admin
  apiGroup: rbac.authorization.k8s.io 
subjects:
- kind: ServiceAccount
  name: admin
  namespace: kube-system
---
apiVersion: v1
kind: ServiceAccount
metadata:
  name: admin
  namespace: kube-system
  labels:
    kubernetes.io/cluster-service: "true"
    addonmanager.kubernetes.io/mode: Reconcile  

获取admin用户token

代码语言:javascript复制
kubectl get secret -n kube-system | grep "admin"
kubectl describe secret admin-token-gb7db  -n kube-system

获取对外服务端口

代码语言:javascript复制
kubectl get service --namespace=kube-system

效果图:

0 人点赞