https://github.com/dotbalo/ratel-doc
Ratel是一个Kubernetes多集群资源管理平台

#查看Dashboard登录的token
kubectl get secret -n kube-system | grep admin-user-token
kubectl describe secret admin-user-token-jszt4 -n kube-system #使用Edge浏览器访问,使用上一步的token值登录
kubectl get svc -n kubernetes-dashboard
https://192.168.56.101:30431

查看集群信息

kubectl cluster-info
#如Kubernetes control plane地址 https://192.168.56.101:6443

kube配置文件信息

ls -a ~/.kube/config
#/root/.kube/configmkdir -p /root/study/ratel
cp ~/.kube/config /root/study/ratel/study.config

编写Ratel配置文件

mkdir ratel && cd ratel
vi servers.yaml vi servers.yaml
- serverName: 'study'serverAddress: 'https://192.168.56.101:6443'#serverAdminUser: 'xxx'#serverAdminPassword: 'xxx#'serverAdminToken: 'null'serverDashboardUrl: "https://192.168.56.101:30431/#"production: 'false'kubeConfigPath: "/mnt/study.config"harborConfig: "HarborUrl, HarborUsername, HarborPassword, HarborEmail"

创建Secret,把配置信息放入到Secret中

kubectl create secret generic ratel-config  --from-file=/root/study/ratel/study.config --from-file=servers.yaml -n kube-systemkubectl create ns kube-users

创建RBAC
vi ratel-rbac.yaml

apiVersion: v1
items:
- apiVersion: rbac.authorization.k8s.io/v1kind: ClusterRolemetadata:annotations:rbac.authorization.kubernetes.io/autoupdate: "true"labels:kubernetes.io/bootstrapping: rbac-defaultsrbac.authorization.k8s.io/aggregate-to-edit: "true"name: ratel-namespace-readonlyrules:- apiGroups:- ""resources:- namespacesverbs:- get- list- watch- apiGroups:- metrics.k8s.ioresources:- podsverbs:- get- list- watch
- apiVersion: rbac.authorization.k8s.io/v1kind: ClusterRolemetadata:name: ratel-pod-deleterules:- apiGroups:- ""resources:- podsverbs:- get- list- delete
- apiVersion: rbac.authorization.k8s.io/v1kind: ClusterRolemetadata:name: ratel-pod-execrules:- apiGroups:- ""resources:- pods- pods/logverbs:- get- list- apiGroups:- ""resources:- pods/execverbs:- create
- apiVersion: rbac.authorization.k8s.io/v1kind: ClusterRolemetadata:annotations:rbac.authorization.kubernetes.io/autoupdate: "true"name: ratel-resource-editrules:- apiGroups:- ""resources:- configmaps- persistentvolumeclaims- services- services/proxyverbs:- patch- update- apiGroups:- appsresources:- daemonsets- deployments- deployments/rollback- deployments/scale- statefulsets- statefulsets/scaleverbs:- patch- update- apiGroups:- autoscalingresources:- horizontalpodautoscalersverbs:- patch- update- apiGroups:- batchresources:- cronjobs- jobsverbs:- patch- update- apiGroups:- extensionsresources:- daemonsets- deployments- deployments/rollback- deployments/scale- ingresses- networkpoliciesverbs:- patch- update- apiGroups:- networking.k8s.ioresources:- ingresses- networkpoliciesverbs:- patch- update
- apiVersion: rbac.authorization.k8s.io/v1kind: ClusterRolemetadata:name: ratel-resource-readonlyrules:- apiGroups:- ""resources:- configmaps- endpoints- persistentvolumeclaims- pods- replicationcontrollers- replicationcontrollers/scale- serviceaccounts- servicesverbs:- get- list- watch- apiGroups:- ""resources:- bindings- events- limitranges- namespaces/status- pods/log- pods/status- replicationcontrollers/status- resourcequotas- resourcequotas/statusverbs:- get- list- watch- apiGroups:- ""resources:- namespacesverbs:- get- list- watch- apiGroups:- appsresources:- controllerrevisions- daemonsets- deployments- deployments/scale- replicasets- replicasets/scale- statefulsets- statefulsets/scaleverbs:- get- list- watch- apiGroups:- autoscalingresources:- horizontalpodautoscalersverbs:- get- list- watch- apiGroups:- batchresources:- cronjobs- jobsverbs:- get- list- watch- apiGroups:- extensionsresources:- daemonsets- deployments- deployments/scale- ingresses- networkpolicies- replicasets- replicasets/scale- replicationcontrollers/scaleverbs:- get- list- watch- apiGroups:- policyresources:- poddisruptionbudgetsverbs:- get- list- watch- apiGroups:- networking.k8s.ioresources:- networkpolicies- ingressesverbs:- get- list- watch- apiGroups:- metrics.k8s.ioresources:- podsverbs:- get- list- watch
kind: List
metadata:resourceVersion: ""selfLink: ""

执行

kubectl create -f ratel-rbac.yaml

设置权限
vi ratel-rbac-binding.yaml

apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:name: ratel-namespace-readonly-sa
roleRef:apiGroup: rbac.authorization.k8s.iokind: ClusterRolename: ratel-namespace-readonly
subjects:
- apiGroup: rbac.authorization.k8s.iokind: Groupname: system:serviceaccounts:kube-users

执行

kubectl create -f ratel-rbac-binding.yaml

部署Ratel

vi ratel-deploy.yaml

apiVersion: apps/v1
kind: Deployment
metadata:labels:app: ratelname: ratelnamespace: kube-system
spec:replicas: 1selector:matchLabels:app: ratelstrategy:rollingUpdate:maxSurge: 1maxUnavailable: 0type: RollingUpdatetemplate:metadata:creationTimestamp: nulllabels:app: ratelspec:containers:- command:- sh- -c- ./ratel -c /mnt/servers.yamlenv:- name: TZvalue: Asia/Shanghai- name: LANGvalue: C.UTF-8- name: ProRunModevalue: prod- name: ADMIN_USERNAMEvalue: admin- name: ADMIN_PASSWORDvalue: ratel_passwordimage: registry.cn-beijing.aliyuncs.com/dotbalo/ratel:latestimagePullPolicy: AlwayslivenessProbe:failureThreshold: 2initialDelaySeconds: 10periodSeconds: 60successThreshold: 1tcpSocket:port: 8888timeoutSeconds: 2name: ratelports:- containerPort: 8888name: webprotocol: TCPreadinessProbe:failureThreshold: 2initialDelaySeconds: 10periodSeconds: 60successThreshold: 1tcpSocket:port: 8888timeoutSeconds: 2resources:limits:cpu: 500mmemory: 512Mirequests:cpu: 500mmemory: 512MivolumeMounts:- mountPath: /mntname: ratel-configdnsPolicy: ClusterFirstimagePullSecrets:- name: myregistrykeyrestartPolicy: AlwaysschedulerName: default-schedulersecurityContext: {}terminationGracePeriodSeconds: 30volumes:- name: ratel-configsecret:defaultMode: 420secretName: ratel-config

执行

kubectl create -f ratel-deploy.yaml

配置Service
vi ratel-svc.yaml

apiVersion: v1
kind: Service
metadata:labels:app: ratelname: ratelnamespace: kube-system
spec:ports:- name: container-1-web-1port: 8888protocol: TCPtargetPort: 8888selector:app: rateltype: NodePort

执行

kubectl create -f ratel-svc.yamlkubectl get pods -n kube-system
kubectl get svc -n kube-system#访问
http://192.168.56.101:30472
admin
ratel_password

Ratel创建应用

Clustes -> study,查看集群运行信息

Deployments -> 创建一个deploy,选择集群study,Namespace默认default,副本数设置成2,Name: nginx-test
Labels配置,app: nginx-test
Pod Seleteors,app: nginx-test

Next,Pod 亲和力可以不设置
Next,Volumes可以挂载卷,如果主机中没有对应的目录,可以删除默认的hostpath挂载

Next,选择镜像地址 nginx:1.15.12-alpine,文件挂载按需求配置
Next,Next,创建一个Service,添加Service: nginx-test,注意端口映射
Next,添加一个Ingress,如 a.com

点击View Yaml可以查看刚才的配置信息
点击Create则会自动创建deploy、Service、Ingress

点击Service -> 查看,找到刚才创建的Service,使用ClusterIP访问一下

curl http://10.96.192.161 kubectl get pods
kubectl get deploy
kubectl get svc

菜单ConfigMap、Secrets,点击查看,可以直接在页面上修改配置值了

k8s 1.25学习8 - 使用Ratel工具部署应用相关推荐

  1. 项目四 CentOS使用kubeadm部署工具部署测试环境的K8s集群---Kubectl命令使用以及安装dashboard界面

    大家好,我是SuieKa.在之前呢有幸学习了马哥教育提供的K8s入门指南以及视频.初来乍到,写一篇关于K8s的介绍以及部署测试环境使用的K8s集群. 树 @·K8s入门简单介绍 一.K8s(Kuber ...

  2. K8s基础知识学习笔记及部分源码剖析

    K8s基础知识学习笔记及部分源码剖析 在学习b站黑马k8s视频资料的基础上,查阅了配套基础知识笔记和源码剖析,仅作个人学习和回顾使用. 参考资料: 概念 | Kubernetes 四层.七层负载均衡的 ...

  3. 第十四课 k8s源码学习和二次开发原理篇-调度器原理

    第十四课 k8s源码学习和二次开发原理篇-调度器原理 tags: k8s 源码学习 categories: 源码学习 二次开发 文章目录 第十四课 k8s源码学习和二次开发原理篇-调度器原理 第一节 ...

  4. 第八课 k8s源码学习和二次开发原理篇-KubeBuilder使用和Controller-runtime原理

    第八课 k8s源码学习和二次开发原理篇-KubeBuilder使用和Controller-runtime原理 tags: k8s 源码学习 categories: 源码学习 二次开发 文章目录 第八课 ...

  5. ngss for oracle,学习笔记:Oracle bbed工具在Windows平台上兼容9i 10g 11g 12c运

    天萃荷净 配置使用在Windows操作系统中中运行Oracle bbed程序兼容9i 10g 11g 12c 学习ORACLE三剑客:互联网,ORACLE资料,交流.今天在朋友的帮助下,了结了一个心结 ...

  6. 第三课 k8s源码学习和二次开发-缓存机制Informers和Reflector组件学习

    第三课 k8s源码学习和二次开发-缓存机制Informers和Reflector组件学习 tags: k8s 源码学习 categories: 源码学习 二次开发 文章目录 第三课 k8s源码学习和二 ...

  7. k8s网络基础学习-Calico网络插件

    第十课 k8s网络基础学习-Calico网络插件 tags: k8s网络 calico proxy arp bgp full mesh bgp RR 文章目录 第十课 k8s网络基础学习-Calico ...

  8. 二进制安装k8s v1.25.4 IPv4/IPv6双栈

    二进制安装k8s v1.25.4 IPv4/IPv6双栈 https://github.com/cby-chen/Kubernetes 开源不易,帮忙点个star,谢谢了 介绍 kubernetes( ...

  9. 《Kubernetes部署篇:基于docker使用kubespray工具部署高可用K8S集群(国内互联网方案四)》

    文章目录 一.部署背景简介 二.部署工具介绍 三.部署方案介绍 四.部署环境信息 五.部署资源下载 六.部署准备工作 6.1.系统内核升级 6.2.设置主机名 6.3.环境初始化 6.4.ssh多机互 ...

最新文章

  1. Map m=new HashMap()
  2. AngelToken揭秘区块链之四大链
  3. 如何下载项目所需要jar包
  4. 关于java中实现在oracle数据库中实现对中文首字母进行排序的解决方案
  5. pve虚拟机导入gho_迁移WIN10和VMW虚拟机到ProXmoX VE(二):PVE设置和迁移windows
  6. JAVA程序设计第十版第七章_java程序设计第七章答案
  7. 广西大学计算机英语复试的内容,广西大学计算机专业的研究生复试时
  8. JavaBean用JSP调用和使用JSP动作标签的区别
  9. 字长为16位的计算机_字长为16位表示这台计算机最大能计算
  10. 通过 mpu6050加速度计算角度
  11. FPGA学习(第2节)-FPGA下载程序到flash+文件转换-通过.sof文件产生.jic文件
  12. 搜索引擎的高级搜索语法指令
  13. QNX 7.1 交叉编译 cron
  14. 想要定制个性化语音?来试试这几个配音软件
  15. python安装教程(搬运工)
  16. win10升级更新2004版卡在49%解决办法
  17. 非LL(1)文法到LL(1)文法的等价变换
  18. [转]微信终端跨平台组件 mars 系列(二) - 信令传输超时设计
  19. 基于网络特征的新型授权机制设想
  20. 辟谣:Deno不是下一代Node.js!

热门文章

  1. c语言五子棋人工智能算法,五子棋人工智能算法实现研究,优化五子棋智能算法的思路...
  2. 数字图像处理与Python实现-边缘检测-高斯差分(DoG)算子边缘检测
  3. 用 js 开启本地服务器,实现短信发送
  4. 树莓派4B上安装OpenWrt/LEDE
  5. iOS Apple登录一些限制与细节
  6. Python小技 不到100行代码制作各种证件照
  7. 小型元器件介绍:排阻
  8. html图片在wps中不显示文字大小,WPS文字插入图片显示不全怎么办 WPS文字插入图片显示不完整的解决方法...
  9. 2014-2015年开发的机器人仿真测试平台
  10. linux lzma命令,Ubuntu: 压缩与解压缩LZMA文件