部署kuboard与使用
16. 部署kuboard
16.1 命令
sudo docker run -d \
--restart=always \
--name=kuboard \
-p 8080:80/tcp \
-p 10081:10081/tcp \
-e KUBOARD_ENDPOINT="http://192.168.1.75:80" \
-e KUBOARD_AGENT_SERVER_TCP_PORT="10081" \
-v /data/kuboard-date:/data \
swr.cn-east-2.myhuaweicloud.com/kuboard/kuboard:v3
- 用户名:admin
- 密码:Kuboard123
16.2 创建集群
-
点击添加集群
-
点击左边以.kubeconfig文件方式添加集群
-
需要把/root/.kube/config文件全部复制进来
#配置文件
root@deploy-harbor:~# cat /root/.kube/config
apiVersion: v1
clusters:
- cluster:
certificate-authority-data: LS0tLS1CRUdJTiBDRVJUSUZJQ0FURS0tLS0tCk1JSURsRENDQW55Z0F3SUJBZ0lVTUV2SXV3UXdTL3lDMXFyUlFpZ1duVjYwRXNJd0RRWUpLb1pJaHZjTkFRRUwKQlFBd1lURUxNQWtHQTFVRUJoTUNRMDR4RVRBUEJnTlZCQWdUQ0VoaGJtZGFhRzkxTVFzd0NRWURWUVFIRXdKWQpVekVNTUFvR0ExVUVDaE1EYXpoek1ROHdEUVlEVlFRTEV3WlRlWE4wWlcweEV6QVJCZ05WQkFNVENtdDFZbVZ5CmJtVjBaWE13SUJjTk1qSXhNVEU1TURZME1qQXdXaGdQTWpFeU1qRXdNall3TmpReU1EQmFNR0V4Q3pBSkJnTlYKQkFZVEFrTk9NUkV3RHdZRFZRUUlFd2hJWVc1bldtaHZkVEVMTUFrR0ExVUVCeE1DV0ZNeEREQUtCZ05WQkFvVApBMnM0Y3pFUE1BMEdBMVVFQ3hNR1UzbHpkR1Z0TVJNd0VRWURWUVFERXdwcmRXSmxjbTVsZEdWek1JSUJJakFOCkJna3Foa2lHOXcwQkFRRUZBQU9DQVE4QU1JSUJDZ0tDQVFFQXQ1QkZtZkh4KzhCQXQ1OTg2QnBjV2Z0Q3VYcVoKMzlmMFBNaGhDTXNGVWtjYThjNzFxV3R0b0g4Mmk4UEpxTzdRL1FRbW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luster1
contexts:
- context:
cluster: cluster1
user: admin
name: context-cluster1
current-context: context-cluster1
kind: Config
preferences: {}
users:
- name: admin
user:
client-certificate-data: LS0tLS1CRUdJTiBDRVJUSUZJQ0FURS0tLS0tCk1JSUQxekNDQXIrZ0F3SUJBZ0lVYTQzSmoza0l2MG0rSENlRFNGSFRoK3BidGdVd0RRWUpLb1pJaHZjTkFRRUwKQlFBd1lURUxNQWtHQTFVRUJoTUNRMDR4RVRBUEJnTlZCQWdUQ0VoaGJtZGFhRzkxTVFzd0NRWURWUVFIRXdKWQpVekVNTUFvR0ExVUVDaE1EYXpoek1ROHdEUVlEVlFRTEV3WlRlWE4wWlcweEV6QVJCZ05WQkFNVENtdDFZbVZ5CmJtVjBaWE13SUJjTk1qSXhNVEU1TURZME1qQXdXaGdQTWpBM01qRXhNRFl3TmpReU1EQmFNR2N4Q3pBSkJnTlYKQkFZVEFrTk9NUkV3RHdZRFZRUUlFd2hJWVc1bldtaHZkVEVMTUFrR0ExVUVCeE1DV0ZNeEZ6QVZCZ05WQkFvVApEbk41YzNSbGJUcHRZWE4wWlhKek1ROHdEUVlEVlFRTEV3WlRlWE4wWlcweERqQU1CZ05WQkFNVEJXRmtiV2x1Ck1JSUJJakFOQmdrcWhraUc5dzBCQVFFRkFBT0NBUThBTUlJQkNnS0NBUUVBdkt3MXFBYkdDRWNqWW1tSHd1Y3YKa09HUUtOL2dxZVZrQUl3aVBpMkNZUXp6RG8zcktxZjFxeTdTYmVhdWFoT0dOV2R2bXlZSmlBeXJnbFdVd1AxegpzNDZQSWFmV3dUeWQvdnFocWRObHdhWGhNRW5xZXhxMU4vN0toOE5WWHc2cjZMU01aMUtwTkRFV2hvY2g3OXNCCkFKN01TZTZKZ0c2aHd6bGQ5ZmtqbjQvMWxIaTNGS0RDNzQyZkR3NStRaGtHQy9lQi8xczlpK282STYwaTQvK2cKSStlMElYcndncUNyZHUrb2t6dmlaRGF1K29ET1NORHFLeTExN2NoVllXV0o2VHVxRWZ6cUxq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端分离
17.1 nginx
root@deploy-harbor:~/nginx-tomcat-case# cat nginx.yaml
kind: Deployment
#apiVersion: extensions/v1beta1
apiVersion: apps/v1
metadata:
labels:
app: linux70-nginx-deployment-label
name: linux70-nginx-deployment
namespace: myserver
spec:
replicas: 1
selector:
matchLabels:
app: linux70-nginx-selector
template:
metadata:
labels:
app: linux70-nginx-selector
spec:
containers:
- name: linux70-nginx-container
image: nginx:1.20
#command: ["/apps/tomcat/bin/run_tomcat.sh"]
#imagePullPolicy: IfNotPresent
imagePullPolicy: Always
ports:
- containerPort: 80
protocol: TCP
name: http
- containerPort: 443
protocol: TCP
name: https
env:
- name: "password"
value: "123456"
- name: "age"
value: "18"
# resources:
# limits:
# cpu: 2
# memory: 2Gi
# requests:
# cpu: 500m
# memory: 1Gi
---
kind: Service
apiVersion: v1
metadata:
labels:
app: linux70-nginx-service-label
name: linux70-nginx-service
namespace: myserver
spec:
type: NodePort
ports:
- name: http
port: 80
protocol: TCP
targetPort: 80
nodePort: 30004
- name: https
port: 443
protocol: TCP
targetPort: 443
nodePort: 30443
selector:
app: linux70-nginx-selector
17.2 tomcat
root@deploy-harbor:~/nginx-tomcat-case# cat tomcat.yaml
kind: Deployment
#apiVersion: extensions/v1beta1
apiVersion: apps/v1
metadata:
labels:
app: linux60-tomcat-app1-deployment-label
name: linux60-tomcat-app1-deployment
namespace: myserver
spec:
replicas: 1
selector:
matchLabels:
app: linux60-tomcat-app1-selector
template:
metadata:
labels:
app: linux60-tomcat-app1-selector
spec:
containers:
- name: linux60-tomcat-app1-container
image: tomcat:7.0.109-jdk8-openjdk
#command: ["/apps/tomcat/bin/run_tomcat.sh"]
#imagePullPolicy: IfNotPresent
imagePullPolicy: Always
ports:
- containerPort: 8080
protocol: TCP
name: http
env:
- name: "password"
value: "123456"
- name: "age"
value: "18"
# resources:
# limits:
# cpu: 2
# memory: 2Gi
# requests:
# cpu: 500m
# memory: 1Gi
---
kind: Service
apiVersion: v1
metadata:
labels:
app: linux60-tomcat-app1-service-label
name: linux60-tomcat-app1-service
namespace: myserver
spec:
type: NodePort
ports:
- name: http
port: 80
protocol: TCP
targetPort: 8080
# nodePort: 30006
selector:
app: linux60-tomcat-app1-selector
#先把这个nodePort端口打开 然后去页面访问
17.3 设置页面 tomcat
-
访问tomcat 因为没有index.jsp页面
-
添加tomcat index页面
cd webapps
mkdir myapp
echo 'myapp time 70 sync' > myapp/index.jsp
17.5 设置代理 nginx
- nginx配置
cat default.conf
server {
listen 80;
listen [::]:80;
server_name localhost;
#access_log /var/log/nginx/host.access.log main;
location / {
root /usr/share/nginx/html;
index index.html index.htm;
}
location /myapp {
proxy_pass http://linux60-tomcat-app1-service;
}
}
- 测试
root@linux70:/etc/nginx/conf.d# nginx -s reload
2022/11/23 07:48:45 [notice] 1632#1632: signal process started
root@linux70:/etc/nginx/conf.d# curl http://linux60-tomcat-app1-service/myapp/index.jsp
myapp time 70 sync