Brc's blog
首页
前端
后端
运维
  • 工作笔记
  • 分类
  • 标签
  • 归档
关于

Brc

努力中
首页
前端
后端
运维
  • 工作笔记
  • 分类
  • 标签
  • 归档
关于
  • 工具安装

  • AWS

  • EKS

    • 扩缩容

      • karpenter
    • 存储

    • devops

    • test

    • CICD

    • 问题
      • 开启或者关闭插件后
        • 需要重新配置jenkins的邮箱
        • 需要重新配置PrometheusRule
        • 需要重新配置jenkins的地址
        • 关闭用户管理员权限
      • 卸载自带的elk
      • 控制台看不到jenkins记录
      • devops-jenkins一直重启
      • devops-jenkins执行器数量配置
      • eks使用efs dynamic provisioning 创建非root容器提示 Operation not permitted
      • 修改nodeSelector
      • 将sonarqubeURL添加到KubeSphere控制台
      • 删除NS时一直在Terminating
  • 其他

  • AWS创建EKS集群
  • 谷歌云创建GKE集群
  • 工作笔记
  • EKS
Brc
2023-06-11
目录

问题

# 开启或者关闭插件后

# 需要重新配置jenkins的邮箱

https://kubesphere.com.cn/docs/v3.3/devops-user-guide/how-to-use/pipelines/jenkins-email/

        - name: EMAIL_SMTP_HOST
          value: smtp.qiye.aliyun.com
        - name: EMAIL_SMTP_PORT
          value: '465'
        - name: EMAIL_USE_SSL
          value: 'true'
        - name: EMAIL_FROM_NAME
          value: KubeSphere
        - name: EMAIL_FROM_ADDR
          value: birenchong@birenchong.cn
        - name: EMAIL_FROM_PASS
          value: Yx123456

# 需要重新配置PrometheusRule

1.配置 CRD-->PrometheusRule-->prometheus-k8s-rules 删除: kubernetes-system-scheduler kubernetes-system-controller-manager

2.检查是否应用 企业空间:system-workspace 项目:kubesphere-monitoring-system 工作负载:有状态副本集:prometheus-k8s

# 需要重新配置jenkins的地址

系统管理->系统配置->Jenkins Location https://jenkins.birenchong.cn/

# 关闭用户管理员权限

# 卸载自带的elk

平台管理--集群管理--集群设置--日志接收器--Elasticsearch--删除 helm uninstall -n kubesphere-logging-system elasticsearch-logging

# 控制台看不到jenkins记录

https://github.com/kubesphere/ks-devops/issues/772 kubesphere-devops-system jenkins-casc-config jenkins_user.yaml

unclassified: eventDispatcher: receiver: http://devops-apiserver.kubesphere-devops-system:9090/v1alpha3/webhooks/jenkins

# devops-jenkins一直重启

设置->增加devops-jenkins limit内存到4096M

# devops-jenkins执行器数量配置

kubesphere-devops-system jenkins-casc-config jenkins_user.yaml

 clouds:
    - kubernetes:
        name: "kubernetes"
        containerCapStr: "3"
1
2
3
4

# eks使用efs dynamic provisioning 创建非root容器提示 Operation not permitted

方法1.使用静态模式创建(StatefulSet)

方法2.在pod中指定 uid 和 gid containers: securityContext: fsGroup: 1014 runAsUser: 1014 runAsGroup: 1014

# 修改nodeSelector

部署: 更多操作-->编辑yaml-->spec里面(dnsPolicy下面)添加: nodeSelector: env: devops

有状态副本集 比如(prometheus-k8s) 定制资源定义-->prometheus-->k8s 编辑yaml-->spec里面(image下面)添加: nodeSelector: env: devops

# 将sonarqubeURL添加到KubeSphere控制台

1.执行以下命令: kubectl edit cm -n kubesphere-system ks-console-config

2.搜寻到 data.client.enableKubeConfig,在下方添加 devops 字段并指定 sonarqubeURL。 client: enableKubeConfig: true devops: # 手动添加该字段。 sonarqubeURL: https://sonarqube.birenchong.cn/ # SonarQube IP 地址。

3.保存该文件。 4.重启服务 kubectl -n kubesphere-devops-system rollout restart deploy devops-apiserver kubectl -n kubesphere-system rollout restart deploy ks-console

# 删除NS时一直在Terminating

root@birenchong-master:~# kubectl get ns
NAME                              STATUS        AGE
argocd                            Active        176d
birenchong-devops                       Active        176d
birenchong-devops-android79v5b          Active        174d
birenchong-devops-crm6stgv              Active        175d
birenchong-devops-game4pqcj             Active        174d
birenchong-devops-h5tmxc2               Active        174d
birenchong-devops-java7g855             Active        174d
birenchong-devops-phpq82rg              Active        4d23h
birenchong-devops-staticzfjl8           Active        174d
birenchong-pre                          Active        175d
birenchong-prod                         Active        175d
birenchong-test                         Active        175d
cert-manager                      Active        168d
default                           Active        176d
kube-node-lease                   Active        176d
kube-public                       Active        176d
kube-system                       Active        176d
kubesphere-controls-system        Active        176d
kubesphere-devops-system          Active        176d
kubesphere-devops-worker          Active        176d
kubesphere-logging-system         Terminating   176d
kubesphere-monitoring-federated   Active        176d
kubesphere-monitoring-system      Active        176d
kubesphere-system                 Active        176d
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26

命名空间导为 json 配置文件

kubectl get ns kubesphere-logging-system -ojson > kubesphere-logging-system.json
1

编辑 json 文件,删除其中的 spec.finalizers 字段

{
    "apiVersion": "v1",
    "kind": "Namespace",
    "metadata": {
    },
    "spec": {
        "finalizers": [
            "kubernetes"
        ]
    },
    "status": {
    }
}
1
2
3
4
5
6
7
8
9
10
11
12
13

另启一个终端,开启kubectl代理

kubectl proxy --port=8081
1

调用 apiserver 接口直接修改命名空间配置。

curl -k -H "Content-Type: application/json" -X PUT --data-binary @编辑过的json文件 http://127.0.0.1:8081/api/v1/namespaces/命名空间的名字/finalize
1
curl -k -H "Content-Type: application/json" -X PUT --data-binary @kubesphere-logging-system.json http://127.0.0.1:8081/api/v1/namespaces/kubesphere-logging-system/finalize
1

检查命名空间是否删除

kubectl get ns kubesphere-logging-system
1
Last Updated: 2023/11/08, 14:45:54
upload-to-gcs
certbot

← upload-to-gcs certbot→

最近更新
01
谷歌云创建GKE集群
07-26
02
ElastiCacheForRedis启用密码
07-26
03
upload-to-gcs
06-29
更多文章>
Theme by Vdoing | Copyright © 2021-2024 Brc | MIT License | 浙ICP备19031881号-4
  • 跟随系统
  • 浅色模式
  • 深色模式
  • 阅读模式