一、Ratel是什么?
Ratel是一个Kubernetes资源平台,基于管理Kubernetes的资源开发,可以管理Kubernetes的Deployment、DaemonSet、StatefulSet、Service、Ingress、Pods、Nodes、Role、ClusterRole、Rolebinding、ClusterRoleBinding、Secret、ConfigMap、PV、PVC等。主要用于以图形化的方式管理k8s的各类资源,提高维护k8s集群的效率及降低出错的概率。
二、安装Ratel
官网:https://github.com/dotbalo/ratel-doc
安装博客:https://www.cnblogs.com/dukuan/p/11883541.html
Ratel的配置文件采用yaml格式:
$ vim servers.yaml
- serverName: 'kubeadm'
serverAddress: '集群访问地址,可以用kubectl cluster-info查看'
#serverAdminUser: 'test1'
#serverAdminPassword: 'test1#'
serverAdminToken: 'null'
serverDashboardUrl: "部署的集群可视化监控平台dashboard地址"
production: 'false'
kubeConfigPath: "/mnt/kubeadm.config"
创建Ratel secret:
$ cp ~/.kube/config kubeadm.config
$ kubectl create secret generic ratel-config --from-file=kubeadm.config --from-file=servers.yaml -n kube-system
创建部署文件:
apiVersion: apps/v1
kind: Deployment
metadata:
labels:
app: ratel
name: ratel
namespace: kube-system
spec:
replicas: 1
selector:
matchLabels:
app: ratel
template:
metadata:
labels:
app: ratel
spec:
containers:
- command:
- sh
- -c
- ./ratel -c /mnt/servers.yaml
env:
- name: TZ
value: Asia/Shanghai
- name: LANG
value: C.UTF-8
- name: ProRunMode
value: prod
- name: ADMIN_USERNAME
value: admin
- name: ADMIN_PASSWORD
value: password
image: dotbalo/ratel:v0.1alpha
livenessProbe:
failureThreshold: 2
initialDelaySeconds: 10
periodSeconds: 60
successThreshold: 1
tcpSocket:
port: 8888
timeoutSeconds: 2
name: ratel
ports:
- containerPort: 8888
name: web
protocol: TCP
readinessProbe:
failureThreshold: 2
initialDelaySeconds: 10
periodSeconds: 60
successThreshold: 1
tcpSocket:
port: 8888
timeoutSeconds: 2
resources:
limits:
cpu: 1000m
memory: 520Mi
requests:
cpu: 100m
memory: 100Mi
volumeMounts:
- mountPath: /mnt
name: ratel-config
restartPolicy: Always
volumes:
- name: ratel-config
secret:
defaultMode: 420
secretName: ratel-config
---
apiVersion: v1
kind: Service
metadata:
labels:
app: ratel
name: ratel
namespace: kube-system
spec:
ports:
- name: container-1-web-1
nodePort: 32568
port: 8888
protocol: TCP
targetPort: 8888
selector:
app: ratel
type: NodePort
配置参数:
ProRunMode: 区别在于dev模式打印的是debug日志, 其他模式是info级别的日志, 实际使用时应该配置为非dev
ADMIN_USERNAME: ratel自己的管理员账号
ADMIN_PASSWORD: ratel自己的管理员密码
实际使用时账号密码应满足复杂性要求,因为ratel可以直接操作所配置的资源。
其他无需配置, 端口配置暂不支持。
部署完成后,进行访问: