• 如何创建静态Pod


    创建静态Pod

    1. 找到kubelet config 文件

    ## 查看配置, 找到 staticPodPath
    cat /var/lib/kubelet/config.yaml
    

    这是默认的 config.yaml文件

    apiVersion: kubelet.config.k8s.io/v1beta1
    authentication:
      anonymous:
        enabled: false
      webhook:
        cacheTTL: 0s
        enabled: true
      x509:
        clientCAFile: /etc/kubernetes/pki/ca.crt
    authorization:
      mode: Webhook
      webhook:
        cacheAuthorizedTTL: 0s
        cacheUnauthorizedTTL: 0s
    cgroupDriver: systemd
    clusterDNS:
    - 10.1.0.10
    clusterDomain: cluster.local
    cpuManagerReconcilePeriod: 0s
    evictionPressureTransitionPeriod: 0s
    fileCheckFrequency: 0s
    healthzBindAddress: 127.0.0.1
    healthzPort: 10248
    httpCheckFrequency: 0s
    imageMinimumGCAge: 0s
    kind: KubeletConfiguration
    logging: {}
    memorySwap: {}
    nodeStatusReportFrequency: 0s
    nodeStatusUpdateFrequency: 0s
    rotateCertificates: true
    runtimeRequestTimeout: 0s
    shutdownGracePeriod: 0s
    shutdownGracePeriodCriticalPods: 0s
    staticPodPath: /etc/kubernetes/manifests
    streamingConnectionIdleTimeout: 0s
    syncFrequency: 0s
    volumeStatsAggPeriod: 0s
    

    2. 在目录 staticPodPath 中放入一个static-web.yaml文件

    apiVersion: v1
    kind: Pod
    metadata:
      name: static-web
      labels:
        name: static-web
    spec:
      containers:
      - name: static-web
        image: nginx
        ports:
        - name: web
          containerPort: 80
    

    3. 重启 kubelet

    ## 执行如下命令使新增参数生效
    systemctl stop kubelet
    systemctl daemon-reload
    systemctl start kubelet
    

    4. 测试

    ## 在当前node,查看 docker 容器是否启动
    docker ps 
    
    ## 在master上查看pod是否启动
    kubectl get pods 
    
    ## 在master上尝试删除这个pod
    [root@master ~]# kubectl delete pod static-web-worker1
    pod "static-web-worker1" deleted
    
    ## 再看看是否删除了,如果不能删除,说明这是个static pod
    [root@master ~]# kubectl get pods
    NAME                        READY   STATUS    RESTARTS      AGE
    static-web-worker1          1/1     Running   0             12s
    
    
  • 相关阅读:
    最常见VC++编译错误信息集合
    网站运营最全总结
    KdPrint/DbgPrint and UNICODE_STRING/ANSI_STRING
    poj 2155 matrix
    【hdu2955】 Robberies 01背包
    【hdu4570】Multi-bit Trie 区间DP
    2014 SCAU_ACM 暑期集训
    qpython 读入数据问题: EOF error with input / raw_input
    【转】Python version 2.7 required, which was not found in the registry
    华农正方系统 登录地址
  • 原文地址:https://www.cnblogs.com/Dannier/p/15787506.html
Copyright © 2020-2023  润新知