【云原生】Kubernetes部署Kanboard项目管理平台
文章目录
介绍
- Kanboard是一个简介而强大的任务看板管理系统,它以敏捷开发理念为基础,皆在帮助个人和团队提高工作效率、优化工作流程。通过其直观的界面和灵活的配置选项,用户可以轻松地进行项目管理、任务分配、并跟踪进度
资源列表
操作系统 | 配置 | 主机名 | IP | k8s版本 |
---|---|---|---|---|
CentOS 7.9 | 2C4G | k8s-master | 192.168.93.101 | v1.18.0 |
CentOS 7.9 | 2C4G | k8s-node01 | 192.168.93.102 | v1.18.0 |
CentOS 7.9 | 2C4G | k8s-node02 | 192.168.93.103 | v1.18.0 |
基础环境
- 关闭防火墙
systemctl stop firewalld
systemctl disable firewalld
- 关闭内核安全机制
setenforce 0
sed -i "s/^SELINUX=.*/SELINUX=disabled/g" /etc/selinux/config
一、检查k8s环境
- 提前部署一个k8s集群,采用kubeadm或二进制安装都可以
1.1、检查工作节点状态
[root@k8s-master ~]# kubectl get node
NAME STATUS ROLES AGE VERSION
k8s-master Ready master 158m v1.18.0
k8s-node01 Ready <none> 157m v1.18.0
k8s-node02 Ready <none> 157m v1.18.0
1.2、检查系统pod状态
- 检查k8s集群中各系统组件的pod状态,确保都处于正常状态
[root@k8s-master ~]# kubectl get pod -n kube-system
NAME READY STATUS RESTARTS AGE
calico-kube-controllers-858fbfbc9-l8tpp 1/1 Running 1 157m
calico-node-k6qbl 1/1 Running 1 157m
calico-node-q969p 1/1 Running 1 157m
calico-node-sv48g 1/1 Running 1 157m
coredns-7ff77c879f-lnl72 1/1 Running 1 158m
coredns-7ff77c879f-nfx7g 1/1 Running 1 158m
etcd-k8s-master 1/1 Running 1 159m
kube-apiserver-k8s-master 1/1 Running 1 159m
kube-controller-manager-k8s-master 1/1 Running 1 159m
kube-proxy-2c282 1/1 Running 1 158m
kube-proxy-6n6pn 1/1 Running 1 158m
kube-proxy-zhm2m 1/1 Running 1 158m
kube-scheduler-k8s-master 1/1 Running 1 159m
二、编辑kanboard.yaml文件
- yaml文件直接复制粘贴即可
2.1、创建项目目录
[root@k8s-master ~]# mkdir -p /data/kanboard
[root@k8s-master ~]# cd /data/kanboard/
2.2、编辑kanboard.yaml文件
- 执行以下命令之前可以选择先导入需要的镜像,手动进行拉取,不然如果镜像拉去不下来的话,pod就会运行不起来,镜像拉取不下来的可以私信或者评论(开源)
[root@k8s-master kanboard]# vim kanboard.yaml
---
apiVersion: v1
kind: Namespace
metadata:
name: kanboard
---
apiVersion: apps/v1
kind: Deployment
metadata:
labels:
app: kanboard
name: kanboard
namespace: kanboard
spec:
replicas: 2
selector:
matchLabels:
app: kanboard
template:
metadata:
labels:
app: kanboard
spec:
volumes:
- name: data
hostPath:
path: /data/kanboard/data/
- name: plugins
hostPath:
path: /data/kanboard/plugins/
- name: ssl
hostPath:
path: /data/kanboard/ssl/
# initContainers:
# - name: volume-permissions
# image: busybox:1.28
# imagePullPolicy: IfNotPresent
# command:
# - sh
# - -c
# - chmod 777 /data/kanboard/data/
# volumeMounts:
# - name: web
# mountPath: /data/kanboard/data/
containers:
- image: kanboard/kanboard:v1.2.26
name: my-kanboard
ports:
- name: web
protocol: "TCP"
containerPort: 80
- name: ssl
protocol: "TCP"
containerPort: 443
env:
- name: TZ
value: "Asia/Shanghai"
resources:
requests:
cpu: 0.1
memory: 0.1G
limits:
cpu: 1
memory: 0.5G
volumeMounts:
- name: data
mountPath: /var/www/html
- name: plugins
mountPath: var/www/app/plugins
- name: ssl
mountPath: /etc/nginx/ssl
---
apiVersion: v1
kind: Service
metadata:
name: my-kanboard
namespace: kanboard
spec:
ports:
- name: web
protocol: TCP
targetPort: 80
port: 80
nodePort: 30080
- name: ssl
protocol: TCP
targetPort: 443
port: 443
nodePort: 30090
selector:
app: kanboard
type: NodePort
三、部署Kanboard
3.1、部署Kanboard服务
- 应用kanboard.yaml文件
[root@k8s-master kanboard]# kubectl apply -f kanboard.yaml
namespace/kanboard created
deployment.apps/kanboard created
service/my-kanboard created
3.2、检查pod状态
# 查看pod的详细信息
[root@k8s-master kanboard]# kubectl get pod -n kanboard -owide
NAME READY STATUS RESTARTS AGE IP NODE NOMINATED NODE READINESS GATES
kanboard-7f447d6bd6-446rz 1/1 Running 0 32s 10.244.85.195 k8s-node01 <none> <none>
kanboard-7f447d6bd6-xtmbl 1/1 Running 0 32s 10.244.58.195 k8s-node02 <none> <none>
3.3、检查pod详细信息
- 查看kanboard的pod详细信息
[root@k8s-master kanboard]# kubectl describe pod -n kanboard kanboard-7f447d6bd6-446rz
Name: kanboard-7f447d6bd6-446rz
Namespace: kanboard
Priority: 0
Node: k8s-node01/192.168.93.102
Start Time: Wed, 19 Jun 2024 12:13:11 +0800
Labels: app=kanboard
pod-template-hash=7f447d6bd6
Annotations: cni.projectcalico.org/containerID: c3055ba62412aa10b5c1bbffa6ad3b54baeb0955d5e81ccbd020e907d395a537
cni.projectcalico.org/podIP: 10.244.85.195/32
cni.projectcalico.org/podIPs: 10.244.85.195/32
Status: Running
IP: 10.244.85.195
IPs:
IP: 10.244.85.195
Controlled By: ReplicaSet/kanboard-7f447d6bd6
Containers:
my-kanboard:
Container ID: docker://cb1b17cbd2e1d9db22b23354527f75f7af4534590adac88bb1b85b34271ee3e5
Image: kanboard/kanboard:v1.2.26
Image ID: docker://sha256:b33bb3dd71a619eb938f5592ec2096250187ad8edde0e5fbe34c8bd3f727b994
Ports: 80/TCP, 443/TCP
Host Ports: 0/TCP, 0/TCP
State: Running
Started: Wed, 19 Jun 2024 12:13:12 +0800
Ready: True
Restart Count: 0
Limits:
cpu: 1
memory: 500M
Requests:
cpu: 100m
memory: 100M
Environment:
TZ: Asia/Shanghai
Mounts:
/etc/nginx/ssl from ssl (rw)
/var/run/secrets/kubernetes.io/serviceaccount from default-token-7k9kj (ro)
/var/www/html from data (rw)
var/www/app/plugins from plugins (rw)
Conditions:
Type Status
Initialized True
Ready True
ContainersReady True
PodScheduled True
Volumes:
data:
Type: HostPath (bare host directory volume)
Path: /data/kanboard/data/
HostPathType:
plugins:
Type: HostPath (bare host directory volume)
Path: /data/kanboard/plugins/
HostPathType:
ssl:
Type: HostPath (bare host directory volume)
Path: /data/kanboard/ssl/
HostPathType:
default-token-7k9kj:
Type: Secret (a volume populated by a Secret)
SecretName: default-token-7k9kj
Optional: false
QoS Class: Burstable
Node-Selectors: <none>
Tolerations: node.kubernetes.io/not-ready:NoExecute for 300s
node.kubernetes.io/unreachable:NoExecute for 300s
Events:
Type Reason Age From Message
---- ------ ---- ---- -------
Normal Scheduled 79s default-scheduler Successfully assigned kanboard/kanboard-7f447d6bd6-446rz to k8s-node01
Normal Pulled 78s kubelet, k8s-node01 Container image "kanboard/kanboard:v1.2.26" already present on machine
Normal Created 78s kubelet, k8s-node01 Created container my-kanboard
Normal Started 78s kubelet, k8s-node01 Started container my-kanboard
3.4、查看service状态
- 检查service状态。kanboard的外部访问端口为30080和30090
# servcie简称svc
[root@k8s-master kanboard]# kubectl get svc -n kanboard
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
my-kanboard NodePort 10.109.78.136 <none> 80:30080/TCP,443:30090/TCP 2m59s
四、访问Kanboard平台
-
访问地址:http://192.168.93.101:30080
-
访问地址:http://192.168.93.101:30090
-
用户名admin、登录密码:admin
-
接下来就可以尽情的去研究啦!!!