Think before you speak, read before you think.

Category: Kubernetes

  • helm

    helm 2 版本 helm version 安装或升级 helm upgrade gitlab-runner gitlab/gitlab-runner –namespace tools -f deploy/gitlab-runner-values.yaml –install –wait 查看 helm status gitlab-runner Init helm init –client-only Dry run, upgrade, deployment pods will rolling update helm upgrade –dry-run –debug -f values.yaml gitlab-runner . istio helm upgrade –dry-run –debug -f values.yaml istio . 清理 helm delete gitlab-runner –purge 查看,更新…

  • k8s 容器内访问 apiserver

    kubectl exec -it cassandra-0  bash -n noah TOKEN=$(cat /var/run/secrets/kubernetes.io/serviceaccount/token) curl https://kubernetes.default.svc.cluster.local/api/v1/namespaces/noah/endpoints/cassandra –header “Authorization: Bearer $TOKEN” –cacert /var/run/secrets/kubernetes.io/serviceaccount/ca.crt

  • 接入 k8s 遇到的问题

    从传统容器接入 k8s 过程中遇到的问题: 1. 某 sdk 要升级(低版本的会导致 istio 容器挂掉) 报错为 Caused by: java.io.IOException: Cannot bind to URL [rmi:///jmxrmi]: javax.naming.CommunicationException [Root exception is java.rmi.ConnectIOException: error during JRMP connection establishment; nested exception is 2. 客户端 HTTP 对外请求被 envoy rule deny 400( bad request ), 原因 HTTP header 里出现了空的 key:value,客户端修复后,问题消失。以下是抓包,见 Content-Type 和 Accept 中间的一行 14:08:37.918970 IP 10.18.19.98.51604 >…

  • kubespray 使用遇到的问题

    1 问题: FAILED! => {“changed”: false, “module_stderr”: “sudo: sorry, you must have a tty to run sudo\n”, “module_stdout”: “”, “msg”: “MODULE FAILURE\nSee stdout/stderr for the exact error”, “rc”: 1} 解决 visudo,将 Defaults requiretty 注释掉 2. FAILED! => {“changed”: false, “msg”: “Failed to reload sysctl: vm.max_map_count = 262144\nnet.ipv4.ip_forward = 1\nsysctl: cannot stat /proc/sys/net/bridge/bridge-nf-call-ip6tables: No such file…

  • kubectl kubectx kubens 快速切换集群和 namespace

    集群和 namespace 信息配置在 ~/.kube/config 查看当前的 context kubectl config current-context 切换 namespace alias kcd=’kubectl config set-context $(kubectl config current-context) –namespace’ 切换集群 kubectl config use-context dev-admin@dev 使用工具进行快速切换 https://github.com/ahmetb/kubectx brew install kubectx 查看 config 配置 kubectl config view

  • k8s 停用一个 deployment statefulset

    将 节点 “扩”成 0 kubectl scale –replicas=0 deployment contract-service -n dev 只能把节点扩成 0 statefulset kubectl scale –replicas=0 statefulset kafka -n dev