![](https://img-blog.csdnimg.cn/20201014180756918.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
k8s
fengfanghuang
huangfangfeng.github.io
展开
-
在容器中控制宿主机的systemd
在容器中控制宿主机的systemd原创 2022-12-12 11:03:49 · 434 阅读 · 0 评论 -
在 Kubernetes Pod中直接操作主机
在 Kubernetes Pod中直接操作主机原创 2022-12-12 10:19:04 · 984 阅读 · 0 评论 -
腾讯gpu-manager
腾讯gpu-manager原创 2022-10-16 22:09:03 · 1439 阅读 · 0 评论 -
第四范式vgpu插件
第四范式vgpu插件原创 2022-10-16 22:04:16 · 1802 阅读 · 2 评论 -
k8s英伟达GPU插件(nvidia-device-plugin)
k8s英伟达GPU插件(nvidia-device-plugin)原创 2022-10-15 23:58:07 · 5500 阅读 · 0 评论 -
loki部署
loki部署原创 2022-10-15 23:48:04 · 1096 阅读 · 0 评论 -
在dockerfile中设置时区
在dockerfile中设置时区原创 2022-06-07 15:27:46 · 2856 阅读 · 3 评论 -
pod网络流量限制性能测试
apiVersion: v1kind: Podmetadata: name: netperf-server annotations: kubernetes.io/egress-bandwidth: 1M kubernetes.io/ingress-bandwidth: 1Mspec: containers: - image: sirot/netperf-latest command: ["/bin/sh","-c","netserver -p 4444 -...原创 2022-01-04 11:24:39 · 818 阅读 · 0 评论 -
[bug]:记一个k8s client-go leaderelection的bug
环境:k8s 1.17.2申请租约后,进程异常结束没有正常释放租约leaderelection.go:308] Failed to release lock: Lease.coordination.k8s.io "go-demo" is invalid: spec.leaseDurationSeconds: Invalid value: 0: must be greater than 0源码:client-go/leaderelection.go at v0.17.2 · kuberne原创 2021-12-31 09:51:24 · 409 阅读 · 0 评论 -
k8s资源定义yaml转结构体
import ( "encoding/json" "io/ioutil" v3 "github.com/projectcalico/libcalico-go/lib/apis/v3" ffmt "gopkg.in/ffmt.v1" yaml2 "k8s.io/apimachinery/pkg/util/yaml") logrus.Printf("parse gnp yaml:%s ", fp) data, err := ioutil.ReadFile(fp) if err !=.原创 2021-12-14 17:16:01 · 530 阅读 · 0 评论 -
k8s-静态pod
1.kubelet 启动时由 --pod-manifest-path 指定的目录(默认/etc/kubernetes/manifests),kubelet会定期扫描这个目录,并根据这个目录下的 .yaml 或 .json 文件进行创建和更新操作。2.静态pod总是由kubelet创建的,并且只在kubelet所在的Node上运行。3. 静态pod 不能通过 api-server来管理,但是可以通过api查看4. 常用的静态pod资源:etcd kube-apiserver kube-con原创 2021-12-21 15:26:14 · 459 阅读 · 0 评论 -
k8s leaderelection
const ( LEASELOCKNAME = "tes" LEASELOCKNAMESPACE = "kube-system")func main () { LeaseLockID = uuid.New().String() client.InitClientSet() run := func(ctx context.Context) { // 添加运行逻辑代码 klog.Info("Controller loop...") select{}.原创 2021-12-16 20:55:08 · 647 阅读 · 0 评论 -
k8s Patch
// annotation nodefunc AnnotaClusterNodes(nodeName string, annotationKey string, annotationNewValue string) error { node, err := K8sClientSet.CoreV1().Nodes().Get(nodeName, metav1.GetOptions{}) if err != nil { return err } annotations := node.Annot.原创 2021-11-26 14:33:05 · 538 阅读 · 0 评论 -
k8s Informer(node)
func NodeListWatch() { fmt.Printf("Start Node List Watch...\n") restClient := K8sClientSet.CoreV1().RESTClient() watchlist := cache.NewListWatchFromClient(restClient, "nodes", k8smetav1.NamespaceAll, fields.Everything()) _, controller := cache.NewIn..原创 2021-11-26 14:27:56 · 266 阅读 · 0 评论 -
prometheus聚合运算
修改prometheus rules configmap,增加规则:(修改后需重启prometheus)groups: - name: cpu_mem_usage_active interval: 30s rules: - record: cpu_usage_active expr: 100 - (avg by (node_name) (irate(node_cpu_seconds_total{mode="idle"}[2m])) ...原创 2021-11-26 14:22:20 · 1158 阅读 · 0 评论 -
k8s clientset
import ( "github.com/sirupsen/logrus" "k8s.io/client-go/kubernetes" "k8s.io/client-go/tools/clientcmd")var ( K8sClientSet kubernetes.Interface)func InitClientSet() { // init clientset for k8s operation // if kubeconf path is empty, Using the .原创 2021-11-26 14:24:13 · 240 阅读 · 0 评论