kubedns插件配置

安装和配置kubedns插件

1、配置文件准备

下载官方的yaml文件目录:kubernetes/cluster/addons/dns。该插件直接使用kubernetes部署,yaml文件经过修改完成部署

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
# git clone https://github.com/xxlaila/kubernetes-yaml.git
# cd kubernetes-yaml/coredns
# sed -i 's/10.96.0.10/10.254.0.2/g' coredns-service.yaml
# kubectl create -f ./
# kubectl get pods,svc,rs -n kube-system
NAME READY STATUS RESTARTS AGE
pod/coredns-68676b6b88-l7b5g 1/1 Running 0 16m

NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
service/coredns ClusterIP 10.254.0.2 <none> 53/UDP,53/TCP 16m

NAME DESIRED CURRENT READY AGE
replicaset.extensions/coredns-68676b6b88 1 1 1 16m

# kubectl get pods -o wide -n kube-system
NAME READY STATUS RESTARTS AGE IP NODE NOMINATED NODE READINESS GATES
coredns-68676b6b88-l7b5g 1/1 Running 0 40m 10.254.28.2 172.21.16.248 <none> <none>

2、安装和配置dashboard

    官方配置文件kubernetes/cluster/addons/dashboard,这里已经修改过了,经过测试部署,直接进入dashboard目录,修改inages参数进行部署

2.1、安装dashboard

1
2
3
4
5
6
7
8
9
10
11
# cd ../kubernetes-dashboard
# kubectl create -f kubernetes-dashboard.yaml
secret/kubernetes-dashboard-certs created
serviceaccount/kubernetes-dashboard created
role.rbac.authorization.k8s.io/kubernetes-dashboard-minimal created
rolebinding.rbac.authorization.k8s.io/kubernetes-dashboard-minimal created
deployment.apps/kubernetes-dashboard created
service/kubernetes-dashboard created
# kubectl get pods -o wide -n kube-system
NAME READY STATUS RESTARTS AGE IP NODE NOMINATED NODE READINESS GATES
kubernetes-dashboard-6c655d9445-4557x 1/1 Running 0 6m54s 10.254.90.2 172.21.16.110 <none> <none>

2.2、配置账户授权

1
2
3
4
5
6
7
8
9
10
11
12
13
14
# kubectl create -f admin-user.yaml 
serviceaccount/admin created
clusterrolebinding.rbac.authorization.k8s.io/admin created
# kubectl describe serviceaccount admin -n kube-system
Name: admin
Namespace: kube-system
Labels: k8s-app=kubernetes-dashboard
Annotations: <none>
Image pull secrets: <none>
Mountable secrets: admin-token-wwjw8
Tokens: admin-token-wwjw8
Events: <none>
# kubectl describe secret admin-token-wwjw8 -n kube-system
在浏览器访问任意节点IP地址http://<node_ip>:30001

3、监控安装

1
2
3
4
5
6
7
# cd ../heapster-influxdb-grafana
# kubectl create -f ./
# kubectl get pods -o wide -n kube-system
NAME READY STATUS RESTARTS AGE IP NODE NOMINATED NODE READINESS GATES
heapster-658646db69-lh5tx 1/1 Running 0 11m 10.254.28.3 172.21.16.248 <none> <none>
monitoring-grafana-7bfc56ffcd-kgh56 1/1 Running 0 11m 10.254.90.3 172.21.16.110 <none> <none>
monitoring-influxdb-7478d7675c-9255v 1/1 Running 0 11m 10.254.85.2 172.21.16.244 <none> <none>

    这里遇到一个怪事情;heapster安装以后图始终无法出来,这里折腾差不多大半天。最后在dashboard的yaml文件里面添加了以下参数,图就可以了,

img

args:
- –auto-generate-certificates
- –token-ttl=43200
- –heapster-host=http://heapster

img

Prometheus的安装请参考《Prometheus 入门》文章,grafana不需要重复部署。只需要在grafana里面增加目录挂在,吧kube-ops 修改kube-system即可

坚持原创技术分享,您的支持将鼓励我继续创作!
0%