Kubernetes(k8s)中dashboard的汉化
1、访问服务器的http://192.168.110.133:8080/ui地址,如下所示:
使用dashboard版本registry.cn-hangzhou.aliyuncs.com/google-containers/kubernetes-dashboard-amd64:v1.5.0。
可以使用命令拉取镜像:docker pull registry.cn-hangzhou.aliyuncs.com/google-containers/kubernetes-dashboard-amd64:v1.5.0
但是貌似此版本无法进行汉化,网上也没有找到好的案例,就升级dashboard版本,发现直接就是汉化过的了,如下所示:
使用docker拉取镜像,docker pull registry.cn-hangzhou.aliyuncs.com/google-containers/kubernetes-dashboard-amd64:v1.6.3
2、查看dashboard的deployment的配置,如下所示:
1 [root@master dashboard]# cat dashboard-deploy.yaml 2 apiVersion: extensions/v1beta1 3 kind: Deployment 4 metadata: 5 # Keep the name in sync with image version and 6 # gce/coreos/kube-manifests/addons/dashboard counterparts 7 name: kubernetes-dashboard-latest 8 namespace: kube-system 9 spec: 10 replicas: 1 11 template: 12 metadata: 13 labels: 14 k8s-app: kubernetes-dashboard 15 version: latest 16 kubernetes.io/cluster-service: "true" 17 spec: 18 containers: 19 - name: kubernetes-dashboard 20 image: 192.168.110.133:5000/kubernetes-dashboard-amd64:v1.6.3 21 resources: 22 # keep request = limit to keep this container in guaranteed class 23 limits: 24 cpu: 100m 25 memory: 50Mi 26 requests: 27 cpu: 100m 28 memory: 50Mi 29 ports: 30 - containerPort: 9090 31 env: 32 - name: ACCEPT_LANGUAGE 33 value: zh 34 args: 35 - --apiserver-host=http://192.168.110.133:8080 36 livenessProbe: 37 httpGet: 38 path: / 39 port: 9090 40 initialDelaySeconds: 30 41 timeoutSeconds: 30 42 [root@master dashboard]#
查看Service的配置,如下所示:
1 [root@master dashboard]# cat dashboard-svc.yaml 2 apiVersion: v1 3 kind: Service 4 metadata: 5 name: kubernetes-dashboard 6 namespace: kube-system 7 labels: 8 k8s-app: kubernetes-dashboard 9 kubernetes.io/cluster-service: "true" 10 spec: 11 selector: 12 k8s-app: kubernetes-dashboard 13 ports: 14 - port: 80 15 targetPort: 9090 16 [root@master dashboard]#
k8s的deploy可以管理rs,rs可以管理pod,但是此时的pod无法被外界访问,需要Service使用选择器,选择Pod的标签进行关联。
外界通过Node访问Service,Service通过选择器,选择指定的标签,和Pod进行关联。