分类目录归档:K8S

[ k8s集群配置 ]


根据尚硅谷k8s视频进行安装

安装虚拟机

  • 1台master ,2台node, 1台软路由openwrt | 主机 | 密码 | | | --- | --- | --- | | master | Ww550076@ | | | node1 | chenhaifeng | | | node2 | chenhaifeng | |

image.png

虚拟机安装

  1. 安装centos7,
  2. 网络设置选择主机
  3. 硬盘100g,
  4. 单文件
  5. 点击硬盘进入后确认就行,其他不用设置
  6. 安装过程中设置root密码
  7. harbor下载地址
wget https://github.com/goharbor/harbor/relea

< Read more >

[ 部署到本地k8s[go-fastdfs] ]


部署到本地的kubesphere

一.docker参考命令

docker run --network=host --name fastdfs -v /data/fastdfs_data:/data -p 8080:8080 -e GO_FASTDFS_DIR=/data sjqzhang/go-fastdfs

二.k8s部署参考

pod.yaml

kind: Pod
apiVersion: v1
metadata:
  name: go-fast-pod-0
  generateName: go-fast-pod-
  namespace: chf-object
  labels:
   

< Read more >

[ djangoblog项目搭建[kubesphere流水线] ]


djangoblog项目地址

本文使用了kubeshphere搭建的k8s平台并添加了devploy流水线部署

前端pod文件nginx_deploy.yaml - 39行volumeMounts为配置文件挂载, 需要提前创建好配置字典

kind: Deployment
apiVersion: apps/v1
metadata:
  name: django-blog-nginx
  namespace: chf-object
  labels:
    app: django-blog-nginx
spec:
  replicas: 1
  selector:
    matchLabels

< Read more >

[ 创建pod服务 ]


一. 配置字典

  1. 配置字典 1. 配置字典

  2. 配置字典 - 名字 2. 名字

  3. 配置字典 - 文件 3. 字典配置

二. 配置副本集pod

  1. 有状态副本集 4. 有状态服务

  2. 有状态副本集 - 名字 5

  3. 有状态副本集 - 容器配置1 6

  4. 有状态副本集 - 容器配置2 7

  5. 有状态副本集 - 储存配置 8

  6. 有状态副本集 - 储存配置 - 挂载持久卷 9

  7. 有状态副本集 - 储存配置 - 挂载配置字典 10

  8. 创建服务 11

  9. 创建服务 - 指定工作负载 12

  10. 创建服务 - 名字 13

  11. 创建服务 - 服务配置(选择访问模式, 保留端口, 选择工作负载) 14

  12. 创建服务 - 高级设置 - 外部访问 15

  13. 查看创建完成的服务 16

  14. 使用服

< Read more >

[ kubesphere流水线 ]


jenkinsfile文件

  • REGISTRY环境变量为dockerhub私有仓库的ip地址
  • DOCKERHUB_NAMESPACE为dockerhub私有仓库的命名空间

1.前端vue3项目配置到nginx

  • 自己指定docker镜像node:latest容器
pipeline {
  agent {
    kubernetes {
      inheritFrom 'nodejs base'
      containerTemplate {
        name 'nodejs'
        image 'node:latest&#

< Read more >

[ kubesphere安装 ]


官网

一. 安装

debain系统, 所有k8s安装到一台主机上

1.1 ssh

注意需要配置允许root用户连接

1.2 安装依赖

apt-get install socat

apt-get install conntrack

apt-get install ebtables

apt-get install ipset

1.3 下载

如果您访问 GitHub/Googleapis 受限

设置时区

export KKZONE=cn

下载

curl -sfL https://get-kk.kubesphere.io | VERSION=v3.0.7 sh -

如果网络正常能连g

< Read more >