This commit is contained in:
HuaYu 2023-10-16 18:40:59 +08:00
parent 27358f3a8a
commit dcc9b1bf52
11 changed files with 138 additions and 0 deletions

5
k8s/hpa.md Normal file
View File

@ -0,0 +1,5 @@
HorizontalPodAutoscaler
动态扩缩容基于cpu和内存
安装插件
1. gihub中查找metrics-server应用
2. 修改yml中镜像,认证端口整数 和volume

Binary file not shown.

After

Width:  |  Height:  |  Size: 227 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 230 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 177 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 270 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 302 KiB

6
k8s/kubesphere/记录.md Normal file
View File

@ -0,0 +1,6 @@
路径
http://hy-node3:30880/clusters/default/base-info
admin
Sxh123456!
网络端口查看
ss -anput |grep port

98
k8s/pv.md Normal file
View File

@ -0,0 +1,98 @@
PV
使用nfs
```
yum install -y nfs-utils
# 查看是否安装
cat /etc/exports
showmount -e 127.0.0.1
systemctl start rpcbind
systemctl enable rpcbind
systemctl status rpcbind
mkdir /data/nfs
mount -f nfs 10.0.0.245:/data/nfs /data/nfs
```
编辑pv.yml
![pv.yml](img/pvQQ截图20231012222434.png)
pvc
![pvc](img/pvcQQ截图20231012223858.png)
deployment
```
apiVersion: v1
kind: Deployment
metadata:
name: dp-pvc
namespace: kube-test
labels:
app: dp-pvc
spec:
selector:
matchLabels:
app: dp-pvc
template:
metadata:
labels:
app: dp-pvc
spec:
containers:
- name :dp-pvc
image: harbor.captain.com/captain/nginx:1.19.8-alpine
ports:
- containerPort: 80
volumeMounts:
- name: dp-pvc
mountPath: /usr/share/nginx/html
volumes:
- name: dp-pvc
persistentVolumeClaim:
claimName: pvc
```
service
```
apiVersion: v1
kind: Service
metadata:
name: dp-pvc
namespace: kube-system
labels:
app: dp-pvc
spec:
# type: ClusterIP
selector:
app: volume
# clusterIP:
ports:
- name: dp-pvc
protocol: TCP
port: 80
targetPort: 80
```
ingress
```
apiVersion: extensions/v1beta1
kind: Ingress
metadata:
name: nginx
namespace: kube-system
labels:
app: nginx
spec:
rules:
- host:
http:
paths:
- path: /
backend:
serviceName:
servicePort:
```

3
k8s/rbac.md Normal file
View File

@ -0,0 +1,3 @@
用户:ServiceAccount
角色:Role,ClusterRole(集群角色无需namespace)
绑定:RoleBinding,ClusterRoleBinding

4
k8s/statefulset.md Normal file
View File

@ -0,0 +1,4 @@
sts
1. 有序部署
2. 固定的IP无clusterIP

22
k8s/配置分离.md Normal file
View File

@ -0,0 +1,22 @@
# configmap
## 使用配置文件
kubectl creat cm env --from-file= -n kube-ticai
![](img/cmQQ截图20231015211952.png)
## 使用环境变量
kubectl creat cm env --from-env-file= -n kube-ticai
envFrom:
# secrity
## opaque 通用型
kubectl create secret generic test --from-file=
kubectl get secret test-v1 -O jsonpath='{.data}'
## kubenretes.io/service-account-token表示k8s服务账户
## kubernetes.io/dockerconfigjson
![](img/secretgarbirQQ截图20231015221730.png)
## kubernetes.io/tls
## kubernetes.io/ssh-auth/basic-auth