一、测试nginx
1.创建web-nginx.yaml 文件
apiVersion: apps/v1
kind: Deployment
metadata:
name: web-nginx
namespace: default
spec:
replicas: 3
selector:
matchLabels:
type: web
template:
metadata:
labels:
type: web
spec:
containers:
- name: web-nginx
image: nginx:alpine
---
apiVersion: v1
kind: Service
metadata:
name: web-nginx-entrypoint
namespace: default
spec:
type: NodePort
selector:
type: web
ports:
- port: 80
targetPort: 80
nodePort: 30001
2.执行
$ kubectl apply -f web-nginx.yaml
deployment.apps/web-nginx created
service/web-nginx-entrypoint created
查看:
$ kubectl get pods -A | grep web-nginx
default web-nginx-8849754ff-cl567 1/1 Running 0 83s
default web-nginx-8849754ff-ftwvf 1/1 Running 0 83s
default web-nginx-8849754ff-r8xzk 1/1 Running 0 83s
3.访问
浏览器访问,都可以访问通
http://10.211.55.20:30001/
http://10.211.55.21:30001/
http://10.211.55.22:30001/
4.删除nginx
$ kubectl delete -f web-nginx.yaml
二、安装metrics-server
1.安装
下载文件
$ wget https://github.com/kubernetes-sigs/metrics-server/releases/download/v0.6.1/components.yaml
修改文件
- --cert-dir=/tmp
- --secure-port=4443
- --kubelet-insecure-tls
- --kubelet-preferred-address-types=InternalIP,Hostname,InternalDNS,ExternalDNS,ExternalIP
添加了 - --kubelet-insecure-tls
拉去镜像
$ docker pull registry.aliyuncs.com/google_containers/metrics-server:v0.6.1
修改tag
$ docker tag registry.aliyuncs.com/google_containers/metrics-server:v0.6.1 k8s.gcr.io/metrics-server/metrics-server:v0.6.1
$ docker rmi -f registry.aliyuncs.com/google_containers/metrics-server:v0.6.1
注意:是给所以机器都安上该镜像
安装
$ kubectl apply -f components.yaml
2.使用
3.卸载
$ kubectl delete -f components.yaml
并删除镜像
三、安装Kuboard V3
1.安装
$ kubectl apply -f https://addons.kuboard.cn/kuboard/kuboard-v3.yaml
查看状态
$ watch kubectl get pods -o wide -n kuboard
打开地址
http://10.211.55.20:30080/
用户名:admin
密码:Kuboard123
查看一下nginx
可看到很多功能,很不错
2.卸载
$ kubectl delete -f https://addons.kuboard.cn/kuboard/kuboard-v3.yaml
清除数据
$ rm -rf /usr/share/kuboard
评论区