Skip to content

Commit

Permalink
增加kubernetes笔记第一节
Browse files Browse the repository at this point in the history
Signed-off-by: Ouyang Chunhui <[email protected]>
  • Loading branch information
jack9603301 committed Sep 22, 2024
1 parent ecd4435 commit b2cb80a
Show file tree
Hide file tree
Showing 15 changed files with 197 additions and 19 deletions.
3 changes: 3 additions & 0 deletions .github/workflows/hexo_auto_deploy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,9 @@ jobs:
- name: clear LXD cache
run: |
sudo lxc exec qhjack /usr/bin/clean_qhjack_web.fish
- name: baidu verfiy
run: |
cp -rfv baidu/* public
- name: Upload files to LXD on direct.qhjack.top
run: |
cp -r public qhjack
Expand Down
7 changes: 4 additions & 3 deletions _config.next.yml
Original file line number Diff line number Diff line change
Expand Up @@ -363,8 +363,8 @@ mobile_layout_economy: false

# Browser header panel color.
theme_color:
light: "#222"
dark: "#222"
light: "#3e4145"
dark: "#7c8577"

# Override browsers' default behavior.
body_scrollbar:
Expand Down Expand Up @@ -416,14 +416,15 @@ reading_progress:
bookmark:
enable: true
# Customize the color of the bookmark.
color: "#222"
color: "#7c8577"
# If auto, save the reading progress when closing the page or clicking the bookmark-icon.
# If manual, only save it by clicking the bookmark-icon.
save: auto

# `Follow me on GitHub` banner in the top-right corner.
github_banner:
enable: true
color: "black"
permalink: https://github.com/jack9603301
title: 关注我的Github

Expand Down
1 change: 1 addition & 0 deletions baidu/baidu_verify_codeva-8oLI3fJ74Y.html
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
67830e6b98c4f20cf2dcecfec99fd5e3
87 changes: 83 additions & 4 deletions blog/_data/styles.styl
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ p {
text-indent: 2em;
}


.admonition {
margin: 1.5625em 0;
padding: .6rem;
Expand All @@ -10,15 +11,15 @@ p {
border-left: .3rem solid #42b983;
border-radius: .3rem;
box-shadow: 0 0.1rem 0.4rem rgba(0,0,0,.05), 0 0 0.05rem rgba(0,0,0,.1);
background-color: #a64444 !important;
background-color: #999d9c !important;
}

p .admonition-title {
position: relative;
margin: -.6rem -.6rem .8em -.6rem !important;
padding: .4rem .6rem .4rem 2.5rem;
font-weight: 700;
background-color:rgba(66, 185, 131, .1);
background-color: #2468a2;
}

.admonition-title::before {
Expand All @@ -27,13 +28,14 @@ p .admonition-title {
left: 2.1em;
width: 12px;
height: 12px;
background-color: #42b983;
background-color: #999d9c;
border-radius: 50%;
content: ' ';
}

.note>.admonition-title, .info>.admonition-title, .todo>.admonition-title {
background-color: #032226;
background-color: #596032;
color: white;
}

.warning>.admonition-title, .attention>.admonition-title, .caution>.admonition-title {
Expand Down Expand Up @@ -74,3 +76,80 @@ p .admonition-title {
.admonition>:last-child {
margin-bottom: 0 !important;
}

if (hexo-config('darkmode')) {
@media (prefers-color-scheme: dark) {
.admonition {
margin: 1.5625em 0;
padding: .6rem;
overflow: hidden;
page-break-inside: avoid;
border-left: .3rem solid #42b983;
border-radius: .3rem;
box-shadow: 0 0.1rem 0.4rem rgba(0,0,0,.05), 0 0 0.05rem rgba(0,0,0,.1);
background-color: #a64444 !important;
}

p .admonition-title {
position: relative;
margin: -.6rem -.6rem .8em -.6rem !important;
padding: .4rem .6rem .4rem 2.5rem;
font-weight: 700;
background-color:rgba(66, 185, 131, .1);
}

.admonition-title::before {
position: absolute;
top: 27.5px;;
left: 2.1em;
width: 12px;
height: 12px;
background-color: #42b983;
border-radius: 50%;
content: ' ';
}

.note>.admonition-title, .info>.admonition-title, .todo>.admonition-title {
background-color: #032226;
}

.warning>.admonition-title, .attention>.admonition-title, .caution>.admonition-title {
background-color: rgb(255,145,0);
}

.failure>.admonition-title, .missing>.admonition-title, .fail>.admonition-title, .error>.admonition-title {
background-color: rgb(255,82,82);
}

.admonition.note, .admonition.info, .admonition.todo {
border-color: #00b8d4;
}

.admonition.warning, .admonition.attention, .admonition.caution {
border-color: #ff9100;
}

.admonition.failure, .admonition.missing, .admonition.fail, .admonition.error {
border-color: #ff5252;
}

.info>.admonition-title::before, .todo>.admonition-title::before {
background-color: #00b8d4;
border-radius: 50%;
}

.warning>.admonition-title::before, .attention>.admonition-title::before, .caution>.admonition-title::before {
background-color: #ff9100;
border-radius: 50%;
}

.failure>.admonition-title::before,.missing>.admonition-title::before,.fail>.admonition-title::before,.error>.admonition-title::before{
background-color: #ff5252;;
border-radius: 50%;
}

.admonition>:last-child {
margin-bottom: 0 !important;
}
}
}
2 changes: 1 addition & 1 deletion blog/_posts/AI发展简史和机遇.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ categories: AI
comments: true
copyright_reprint: false
description: 最近GPT的概念火爆,大量的自媒体故意引导流量,大肆吹嘘GPT,那么现在,我们就一起探讨下AI的发展历史,和GPT在其中的角色
abbrlink: 2076766547
abbrlink: 2076766741
date: 2023-05-06 13:20:09
---

Expand Down
70 changes: 70 additions & 0 deletions blog/_posts/K8s初期探索笔记-第一节.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
---
title: K8s初期探索笔记-第一节
tags:
- Devops
- 运维/OPS
- kubernetes(k8s)
comments: true
copyright_reprint: false
description: 最近在学习k8s,这是笔记
abbrlink: 3278372884
date: 2024-09-21 13:16:21
---

# k8s的组织架构

k8s一般由三个或者三个以上节点组成,它遵循集群的一般要求,并且有以下基础类型组成:

1. Master 节点

Master 是集群的控制节点,即主节点。 在Kubernetes集群中需要由一个或者一组 Master, 负责管理和控制整个集群。 Master通常占有一台独立的服务器(在高可用模式下建议使用三台或者以上的服务器),是整个集群的【大脑】,如果它发生宕机或者不可用,那么对集群中容器应用的管理都将无法实施。

在 Master 上运行着以下关键进程

- Kubernetes API Server(kube-apiserver): 提供 HTTP RESTful API接口的主要服务,是Kubernetes中对所有资源进行增、删、改、查等操作的唯一入口,也是集群控制的入口进程。
- Kubernetes Controller Manager(kube-controller-manager): Kubernetes 中所有资源对象的自动化控制中心,可以将其理解为资源对象的【大总管】
- Kubernetes Scheduler(kube-scheduler): 负责将资源调度(Pod 调度)的进程,相当于公交调度室。

另外,在Master上通常还需要部署`etcd`服务。

如果将原本部署在Master上的这些进程以`Pod`的方式部署在`Node`上,比如采用`kubedam`安装`Kubernetes`集群,那么此时`Kubernetes`集群中就没有`Master`了,因为所有节点都是`Node`

2. Node节点

`Kubernetes`中,除`Master`外的其他服务器被称为`Node``Node`在较早的一些版本也被称为`Minion`。与`Master`一样,`Node`既可以的一台物理主机,也可以是一台虚拟机。`Node``Kubernetes`集群的工作负载节点,每个`Node`都会被`Master`分配一些工作负载(`Docker`容器),当某个`Node`宕机时,其上的工作负载都会被`Master`自动转移到其他`Node`上。在每个`Node`上都运行着以下关键进程:

- kubelet: 负责`Pod`对应容器的创建、启停等任务,同时与`Master`密切协作,实现集群管理的基本功能
- kube-proxy: 是实现`Kubernetes Service`通讯与负载均衡机制的服务
- 容器运行时

`Node`可以在运行期间被动态增加到`Kubernetes`集群中,前提是在这个`Node`上已经正确的安装、配置和启动了上述关键进程。在默认情况下,`kubelet`会向`Master`注册自己,这也是`Kubernetes`推荐的`Node`管理方式。一旦`Node`被纳入集群管理范畴,`kubelet`进程就会定时向`Master`汇报自身的情报,例如操作系统、主机CPU和内存的使用情况,以及当前有哪些`Pod`在运行等,这样`Master`就可以获知每个`Node`的资源使用情况,并实现高效均衡的资源调度策略了,而某个`Node`在超过指定时间不上报信息时,会被`Master`判定为【失联】,该`Node`状态被标记为【NotReady】,`Master`随后会触发【故障转移】的的自动流程。

查看集群中有多少节点的命令如下:

```bash
kubectl get nodes
```

# 命名空间

命名空间是集群类里面一个重要的基础概念,它在很多情况可以实现多租户隔离,典型的一个思路是给每个租户分配一个命名空间,命名空间属于`Kubernetes`集群范畴的资源对象,在一个集群可以创建多个命名空间,每个命名空间都是独立的存在,属于不同命名空间的资源对象在逻辑上互相隔离。在每个`Kubernetes`集群安装完成且正常运行后,`Master`会自动创建两个命名空间:

- default(默认)
- kub-system(Kubernetes系统级)

用户创建的资源对象如果没有指定命名空间,则被默认都安装在`kube-system`命名空间中。我们可以通过命名空间将集群的资源对象【分配】到不同的命名空间中,形成逻辑上分组的不同项目、小组或者用户组,便于不同的分组共享整个集群的资源的同时被分别管理。当给每个租户都创建了一个命名空间来实现多租户管理的资源隔离时,还能结合`Kubernetes`的资源配额管理,限定不同租户能占用的资源,例如CPU私有量和内存使用量等

命名空间的定义如下:

```yaml
apiVersion: v1
kind: Namespace
metadata:
name: development
```
执行以下命令来创建此定义:
```
kubectl apply -f <namespace.yaml>
```
2 changes: 1 addition & 1 deletion blog/_posts/fish-shell的配置和使用.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ post_link: 'https://www.xiebruce.top/1811.html'
copyright_reprint: true
description: >-
我之前写过一篇文章:[Mac/Linux下配置iTerm2+zsh+powerline美化终端窗口](https://www.xiebruce.top/590.html),文章介绍了使用zsh后,使我们敲命令更加的便捷,看上去也更加的美观。
abbrlink: 2634740317
abbrlink: 2634740511
---
我之前写过一篇文章:[Mac/Linux下配置iTerm2+zsh+powerline美化终端窗口](https://www.xiebruce.top/590.html),文章介绍了使用zsh后,使我们敲命令更加的便捷,看上去也更加的美观。

Expand Down
2 changes: 1 addition & 1 deletion blog/_posts/theme注入器实现养鱼特效.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ categories: hexo
copyright_reprint: false
comments: true
description: 大家是不是好奇别人的博客如何实现养鱼特效呢,这里就告诉你如何实现hexo Next Themes 的养鱼特效
abbrlink: 549972999
abbrlink: 549973193
date: 2023-03-22 12:20:50
---

Expand Down
2 changes: 1 addition & 1 deletion blog/_posts/在Debian-11中源码编译mysql-8-0-30.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ author: Xie Bruce
comments: true
post_link: 'https://www.xiebruce.top/1811.html'
copyright_reprint: true
abbrlink: 516259959
abbrlink: 516260153
description: 在Debian中源码编译mysql 8.0.30,整个过程比较详细的解释了一些很多文章没有写,但是很多人又不太懂的知识。
date: 2022-10-09 23:24:02
---
Expand Down
2 changes: 1 addition & 1 deletion blog/_posts/在gentoo安装和配置fish.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ categories: linux
comments: true
copyright_reprint: false
description: 在这篇文章我们将在gentoo上安装fish,一个非常有意思的shell
abbrlink: 3509176900
abbrlink: 3509177094
date: 2022-11-29 14:40:16
---

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ categories: linux
comments: true
copyright_reprint: false
description: 我将在Gentoo系统上部署基于WayLand的定制桌面环境
abbrlink: 4097776901
abbrlink: 4097777095
date: 2022-12-09 17:16:20
---
# 背景
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ categories: linux
comments: true
copyright_reprint: false
description: 这是一次故障记录
abbrlink: 3117127320
abbrlink: 3117127514
date: 2022-12-01 13:34:21
---

Expand Down
2 changes: 1 addition & 1 deletion blog/_posts/给Orangepo-3-LTS安装gentoo.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ tags:
categories: linux
author: 杰克
comments: true
abbrlink: 4150104778
abbrlink: 4150104972
date: 2022-07-31 16:23:00
---

Expand Down
2 changes: 1 addition & 1 deletion blog/_posts/转入hexo,第一篇博客,部署.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ tags:
categories: hexo
author: 杰克
comments: true
abbrlink: 683963388
abbrlink: 683963582
date: 2022-05-17 20:16:55
---

Expand Down
30 changes: 27 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,38 @@
"hexo-renderer-ejs": "^2.0.0",
"hexo-renderer-stylus": "^2.0.0",
"hexo-server": "^3.0.0",
"hexo-theme-landscape": "^0.0.3"
"hexo-theme-landscape": "^0.0.3",
"jquery": "3.6.3",
"@fancyapps/fancybox": "3.5.7",
"@next-theme/pjax": "0.6.0",
"animejs": "3.2.1",
"@fortawesome/fontawesome-free": "6.2.1",
"prismjs": "1.29.0",
"mathjax": "3.2.2",
"katex": "0.16.4",
"medium-zoom": "1.0.8",
"lozad": "1.16.0",
"pangu": "4.0.7",
"quicklink": "2.3.0",
"disqusjs": "3.0.2",
"gitalk": "1.8.0",
"firebase": "9.16.0",
"algoliasearch": "4.14.3",
"instantsearch.js": "4.50.1",
"hexo-generator-searchdb": "1.4.1",
"pdfobject": "2.2.8",
"mermaid": "9.3.0",
"animate.css": "3.1.1",
"pace-js": "1.2.4",
"ribbon.js": "1.0.2",
"@creativecommons/vocabulary": "2020.11.3"
},
"devDependencies": {
"@next-theme/eslint-config": "0.0.3",
"@next-theme/plugins": "^8.11.1",
"@next-theme/plugins": "^8.21.0",
"chai": "4.3.6",
"eslint": "8.14.0",
"hexo": "6.1.0",
"hexo": "^6.2.0",
"hexo-deployer-git": "^3.0.0",
"hexo-generator-search": "^2.4.3",
"hexo-renderer-markdown-it": "^6.0.1",
Expand Down

0 comments on commit b2cb80a

Please sign in to comment.