K8S cluster with multi-masters on Azure VM

news2024/11/19 1:44:17

拓扑参考:

在这里插入图片描述

在 Azure VM 实例上部署 KubeSphere

  • 基础模板
    需要修改 IP 地址和 VM Image的可以在模板中修改。

    {
        "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
        "contentVersion": "1.0.0.0",
        "parameters": {
            "vmNamePrefix": {
                "defaultValue": "master-",
                "type": "String",
                "metadata": {
                    "description": "The name of your VM master node."
                }
            },
            "vmssName": {
                "defaultValue": "node",
                "type": "String",
                "metadata": {
                    "description": "The name of your VMSS cluster."
                }
            },
            "location": {
                "defaultValue": "[resourceGroup().location]",
                "type": "String",
                "metadata": {
                    "description": "Location for all resources."
                }
            },
            "adminUsername": {
                "type": "String",
                "metadata": {
                    "description": "Username for the Virtual Machine."
                }
            },
            "adminKey": {
                "type": "SecureString",
                "metadata": {
                    "description": "SSH Key for the Virtual Machine."
                }
            },
            "defaultMasterCount": {
                "defaultValue": 3,
                "type": "Int",
                "metadata": {
                    "description": "The default instances count of master"
                }
            },
            "defaultNodeCount": {
                "defaultValue": 3,
                "type": "Int",
                "metadata": {
                    "description": "The initial node size of your VMSS cluster."
                }
            },
            "minNodeCount": {
                "defaultValue": 1,
                "type": "Int",
                "metadata": {
                    "description": "The min node size of your VMSS cluster."
                }
            },
            "maxNodeCount": {
                "defaultValue": 20,
                "type": "Int",
                "metadata": {
                    "description": "The max node size of your VMSS cluster."
                }
            },
            "dnsLabelPrefix": {
                "defaultValue": "[toLower(concat('k8s-cluster-', uniqueString(resourceGroup().id)))]",
                "type": "String",
                "metadata": {
                    "description": "Unique DNS Name for the Public IP used to access the Virtual Machine."
                }
            },
            "vmSize": {
                "defaultValue": "Standard_DS2_v2",
                "type": "String",
                "metadata": {
                    "description": "The size of the VM"
                }
            },
            "virtualNetworkName": {
                "defaultValue": "vNetwork",
                "type": "String",
                "metadata": {
                    "description": "Name of the Virtual Network"
                }
            },
            "subnetName": {
                "defaultValue": "Subnet",
                "type": "String",
                "metadata": {
                    "description": "Name of the subnet in the virtual network"
                }
            },
            "vmssSubnetName": {
                "defaultValue": "nodeSubnet",
                "type": "String",
                "metadata": {
                    "description": "Name of the VMSS subnet in the virtual network"
                }
            },
            "publicLBName": {
                "defaultValue": "publicLB",
                "type": "String",
                "metadata": {
                    "description": "Internal Load Balancer name"
                }
            }
        },
        "variables": {
            "publicIPAddressName": "[concat(parameters('publicLBName'), 'IP' )]",
            "availabilitySetName": "masterAvSet",
            "networkInterfaceName": "[concat(parameters('vmNamePrefix'),'Interface')]",
            "networkSecurityGroupName": "[concat(parameters('virtualNetworkName'),'nsg-default')]",
            "subnetRef": "[resourceId('Microsoft.Network/virtualNetworks/subnets', parameters('virtualNetworkName'), parameters('subnetName'))]",
            "vmssSubnetRef": "[resourceId('Microsoft.Network/virtualNetworks/subnets', parameters('virtualNetworkName'), parameters('vmssSubnetName'))]",
            "osDiskType": "Standard_LRS",
            "publicLBID": "[resourceId('Microsoft.Network/loadBalancers',parameters('publicLBName'))]"
        },
        "resources": [
            {
                "type": "Microsoft.Network/networkSecurityGroups",
                "apiVersion": "2015-06-15",
                "name": "[variables('networkSecurityGroupName')]",
                "location": "[parameters('location')]",
                "properties": {
                    "securityRules": [
                        {
                            "name": "Port_SSH",
                            "properties": {
                                "description": "SSH",
                                "protocol": "*",
                                "sourcePortRange": "*",
                                "destinationPortRange": "22",
                                "sourceAddressPrefix": "*",
                                "destinationAddressPrefix": "*",
                                "access": "Allow",
                                "priority": 100,
                                "direction": "Inbound",
                                "sourcePortRanges": [],
                                "destinationPortRanges": [],
                                "sourceAddressPrefixes": [],
                                "destinationAddressPrefixes": []
                            }
                        },
                        {
                            "name": "Port_API_Server",
                            "properties": {
                                "description": "k8s API Server",
                                "protocol": "TCP",
                                "sourcePortRange": "*",
                                "destinationPortRange": "6443",
                                "sourceAddressPrefix": "*",
                                "destinationAddressPrefix": "*",
                                "access": "Allow",
                                "priority": 140,
                                "direction": "Inbound",
                                "sourcePortRanges": [],
                                "destinationPortRanges": [],
                                "sourceAddressPrefixes": [],
                                "destinationAddressPrefixes": []
                            }
                        },
                        {
                            "name": "Port_Http",
                            "properties": {
                                "description": "Web",
                                "protocol": "TCP",
                                "sourcePortRange": "*",
                                "destinationPortRange": "80",
                                "sourceAddressPrefix": "*",
                                "destinationAddressPrefix": "*",
                                "access": "Allow",
                                "priority": 120,
                                "direction": "Inbound",
                                "sourcePortRanges": [],
                                "destinationPortRanges": [],
                                "sourceAddressPrefixes": [],
                                "destinationAddressPrefixes": []
                            }
                        },
                        {
                            "name": "Port_Https",
                            "properties": {
                                "protocol": "TCP",
                                "sourcePortRange": "*",
                                "destinationPortRange": "443",
                                "sourceAddressPrefix": "*",
                                "destinationAddressPrefix": "*",
                                "access": "Allow",
                                "priority": 130,
                                "direction": "Inbound",
                                "sourcePortRanges": [],
                                "destinationPortRanges": [],
                                "sourceAddressPrefixes": [],
                                "destinationAddressPrefixes": []
                            }
                        }
                    ]
                }
            },
            {
                "type": "Microsoft.Network/virtualNetworks",
                "apiVersion": "2019-11-01",
                "name": "[parameters('virtualNetworkName')]",
                "location": "[parameters('location')]",
                "dependsOn": [
                    "[resourceId('Microsoft.Network/networkSecurityGroups/', variables('networkSecurityGroupName'))]"
                ],
                "properties": {
                    "addressSpace": {
                        "addressPrefixes": [
                            "10.211.0.0/16"
                        ]
                    },
                    "subnets": [
                        {
                            "name": "[parameters('vmssSubnetName')]",
                            "properties": {
                                "networkSecurityGroup": {
                                    "id": "[resourceId('Microsoft.Network/networkSecurityGroups', variables('networkSecurityGroupName'))]"
                                },
                                "addressPrefix": "10.211.0.0/24"
                            }
                        },
                        {
                            "name": "[parameters('subnetName')]",
                            "properties": {
                                "networkSecurityGroup": {
                                    "id": "[resourceId('Microsoft.Network/networkSecurityGroups', variables('networkSecurityGroupName'))]"
                                },
                                "addressPrefix": "10.211.1.0/24"
                            }
                        }
                    ]
                }
            },
            {
                "type": "Microsoft.Network/networkInterfaces",
                "apiVersion": "2019-11-01",
                "name": "[concat(variables('networkInterfaceName'), copyindex())]",
                "location": "[parameters('location')]",
                "dependsOn": [
                    "[resourceId('Microsoft.Network/virtualNetworks/', parameters('virtualNetworkName'))]",
                    "[resourceId('Microsoft.Network/loadBalancers/', parameters('publicLBName'))]"
                ],
                "properties": {
                    "ipConfigurations": [
                        {
                            "name": "ipconfig1",
                            "properties": {
                                "subnet": {
                                    "id": "[variables('subnetRef')]"
                                },
                                "loadBalancerBackendAddressPools": [
                                    {
                                        "id": "[concat(variables('publicLBID'), '/backendAddressPools/BackendPoolMaster')]"
                                    }
                                ],
                                "loadBalancerInboundNatRules": [
                                    {
                                        "id": "[concat(variables('publicLBID'), '/inboundNatRules/lbNAT-master',copyindex())]"
                                    }
                                ],
                                "privateIPAllocationMethod": "Dynamic"
                            }
                        }
                    ]
                },
                "copy": {
                    "name": "nicLoop",
                    "count": "[parameters('defaultMasterCount')]"
                }
            },
            {
                "type": "Microsoft.Network/publicIPAddresses",
                "apiVersion": "2019-09-01",
                "name": "[variables('publicIPAddressName')]",
                "location": "[parameters('location')]",
                "sku": {
                    "name": "Standard"
                },
                "properties": {
                    "publicIPAllocationMethod": "Static",
                    "publicIPAddressVersion": "IPv4",
                    "dnsSettings": {
                        "domainNameLabel": "[parameters('dnsLabelPrefix')]"
                    },
                    "idleTimeoutInMinutes": 10
                }
            },
            {
                "type": "Microsoft.Network/loadBalancers",
                "apiVersion": "2018-06-01",
                "name": "[parameters('publicLBName')]",
                "location": "[parameters('location')]",
                "dependsOn": [
                    "[concat('Microsoft.Network/publicIPAddresses/', variables('publicIPAddressName'))]"
                ],
                "sku": {
                    "name": "Standard"
                },
                "properties": {
                    "frontendIPConfigurations": [
                        {
                            "name": "LoadBalancerFrontEnd",
                            "properties": {
                                "publicIPAddress": {
                                    "id": "[resourceId('Microsoft.Network/publicIPAddresses',variables('publicIPAddressName'))]"
                                }
                            }
                        }
                    ],
                    "backendAddressPools": [
                        {
                            "name": "BackendPoolNode"
                        },
                        {
                            "name": "BackendPoolMaster"
                        }
                    ],
                    "loadBalancingRules": [
                        {
                            "name": "HttpLBRule",
                            "properties": {
                                "frontendIPConfiguration": {
                                    "id": "[concat(variables('publicLBID'),'/frontendIPConfigurations/LoadBalancerFrontEnd')]"
                                },
                                "backendAddressPool": {
                                    "id": "[concat(variables('publicLBID'),'/backendAddressPools/BackendPoolNode')]"
                                },
                                "protocol": "Tcp",
                                "frontendPort": 80,
                                "backendPort": 80,
                                "enableFloatingIP": false,
                                "disableOutboundSnat": false,
                                "idleTimeoutInMinutes": 5,
                                "probe": {
                                    "id": "[concat(variables('publicLBID'),'/probes/tcpProbe')]"
                                }
                            }
                        },
                        {
                            "name": "APILBRule",
                            "properties": {
                                "frontendIPConfiguration": {
                                    "id": "[concat(variables('publicLBID'),'/frontendIPConfigurations/LoadBalancerFrontEnd')]"
                                },
                                "backendAddressPool": {
                                    "id": "[concat(variables('publicLBID'),'/backendAddressPools/BackendPoolMaster')]"
                                },
                                "protocol": "Tcp",
                                "frontendPort": 6443,
                                "backendPort": 6443,
                                "enableFloatingIP": false,
                                "disableOutboundSnat": false,
                                "idleTimeoutInMinutes": 5,
                                "probe": {
                                    "id": "[concat(variables('publicLBID'),'/probes/apitcpProbe')]"
                                }
                            }
                        }
                    ],
                    "probes": [
                        {
                            "name": "tcpProbe",
                            "properties": {
                                "protocol": "Tcp",
                                "port": 80,
                                "intervalInSeconds": 5,
                                "numberOfProbes": 2
                            }
                        },
                        {
                            "name": "apitcpProbe",
                            "properties": {
                                "protocol": "Tcp",
                                "port": 6443,
                                "intervalInSeconds": 5,
                                "numberOfProbes": 2
                            }
                        }
                    ],
                    "inboundNatRules": [
                        {
                            "name": "lbNAT-master0",
                            "properties": {
                                "frontendIPConfiguration": {
                                    "id": "[concat(variables('publicLBID'),'/frontendIPConfigurations/LoadBalancerFrontEnd')]"
                                },
                                "protocol": "Tcp",
                                "frontendPort": "50200",
                                "backendPort": "22"
                            }
                        },
                        {
                            "name": "lbNAT-master1",
                            "properties": {
                                "frontendIPConfiguration": {
                                    "id": "[concat(variables('publicLBID'),'/frontendIPConfigurations/LoadBalancerFrontEnd')]"
                                },
                                "protocol": "Tcp",
                                "frontendPort": "50201",
                                "backendPort": "22"
                            }
                        },
                        {
                            "name": "lbNAT-master2",
                            "properties": {
                                "frontendIPConfiguration": {
                                    "id": "[concat(variables('publicLBID'),'/frontendIPConfigurations/LoadBalancerFrontEnd')]"
                                },
                                "protocol": "Tcp",
                                "frontendPort": "50202",
                                "backendPort": "22"
                            }
                        }
                    ],
                    "inboundNatPools": [
                        {
                            "name": "lbNAT-node",
                            "properties": {
                                "frontendIPConfiguration": {
                                    "id": "[concat(variables('publicLBID'),'/frontendIPConfigurations/LoadBalancerFrontEnd')]"
                                },
                                "protocol": "Tcp",
                                "frontendPortRangeStart": 50100,
                                "frontendPortRangeEnd": 50199,
                                "backendPort": 22
                            }
                        }
                    ]
                }
            },
            {
                "type": "Microsoft.Compute/availabilitySets",
                "apiVersion": "2016-04-30-preview",
                "name": "[variables('availabilitySetName')]",
                "location": "[parameters('location')]",
                "properties": {
                    "platformFaultDomainCount": 2,
                    "platformUpdateDomainCount": 2,
                    "managed": true
                }
            },
            {
                "type": "Microsoft.Compute/virtualMachines",
                "apiVersion": "2019-07-01",
                "name": "[concat(parameters('vmNamePrefix'), copyindex())]",
                "location": "[parameters('location')]",
                "dependsOn": [
                    "[concat('Microsoft.Network/networkInterfaces/', variables('networkInterfaceName'), copyindex())]",
                    "[concat('Microsoft.Compute/availabilitySets/', variables('availabilitySetName'))]",
                    "[concat('Microsoft.Compute/virtualMachineScaleSets/', parameters('vmssName'))]"
                ],
                "properties": {
                    "availabilitySet": {
                        "id": "[resourceId('Microsoft.Compute/availabilitySets',variables('availabilitySetName'))]"
                    },
                    "hardwareProfile": {
                        "vmSize": "[parameters('vmSize')]"
                    },
                    "storageProfile": {
                        "osDisk": {
                            "createOption": "FromImage",
                            "managedDisk": {
                                "storageAccountType": "[variables('osDiskType')]"
                            }
                        },
                        "imageReference": {
                            "publisher": "Canonical",
                            "offer": "0001-com-ubuntu-server-focal",
                            "sku": "20_04-lts-gen2",
                            "version": "latest"
                        }
                    },
                    "networkProfile": {
                        "networkInterfaces": [
                            {
                                "id": "[resourceId('Microsoft.Network/networkInterfaces',concat(variables('networkInterfaceName'),copyindex()))]"
                            }
                        ]
                    },
                    "osProfile": {
                        "computerName": "[concat(parameters('vmNamePrefix'), copyindex())]",
                        "adminUsername": "[parameters('adminUsername')]",
                        "adminPassword": "[parameters('adminKey')]",
                        "linuxConfiguration": {
                            "disablePasswordAuthentication": true,
                            "ssh": {
                                "publicKeys": [
                                    {
                                        "path": "[concat('/home/', parameters('adminUsername'), '/.ssh/authorized_keys')]",
                                        "keyData": "[parameters('adminKey')]"
                                    }
                                ]
                            }
                        }
                    }
                },
                "copy": {
                    "name": "virtualMachineLoop",
                    "count": "[parameters('defaultMasterCount')]"
                }
            },
            {
                "type": "Microsoft.Compute/virtualMachineScaleSets",
                "apiVersion": "2019-07-01",
                "name": "[parameters('vmssName')]",
                "location": "[parameters('location')]",
                "dependsOn": [
                    "[concat('Microsoft.Network/virtualNetworks/', parameters('virtualNetworkName'))]",
                    "[concat('Microsoft.Network/loadBalancers/', parameters('publicLBName'))]"
                ],
                "tags": {
                    "cluster-autoscaler-enabled": "true",
                    "cluster-autoscaler-name": "[resourceGroup().name]",
                    "min": "[parameters('minNodeCount')]",
                    "max": "[parameters('maxNodeCount')]",
                    "poolName": "[parameters('vmssName')]"
                },
                "sku": {
                    "name": "[parameters('vmSize')]",
                    "tier": "Standard",
                    "capacity": "[parameters('defaultNodeCount')]"
                },
                "properties": {
                    "overprovision": false,
                    "upgradePolicy": {
                        "mode": "Manual"
                    },
                    "virtualMachineProfile": {
                        "storageProfile": {
                            "osDisk": {
                                "createOption": "FromImage",
                                "caching": "ReadWrite"
                            },
                            "imageReference": {
                                "publisher": "Canonical",
                                "offer": "0001-com-ubuntu-server-focal",
                                "sku": "20_04-lts-gen2",
                                "version": "latest"
                            }
                        },
                        "osProfile": {
                            "computerNamePrefix": "[parameters('vmssName')]",
                            "adminUsername": "[parameters('adminUsername')]",
                            "adminPassword": "[parameters('adminKey')]",
                            "linuxConfiguration": {
                                "disablePasswordAuthentication": true,
                                "ssh": {
                                    "publicKeys": [
                                        {
                                            "path": "[concat('/home/', parameters('adminUsername'), '/.ssh/authorized_keys')]",
                                            "keyData": "[parameters('adminKey')]"
                                        }
                                    ]
                                }
                            }
                        },
                        "networkProfile": {
                            "networkInterfaceConfigurations": [
                                {
                                    "name": "[concat(parameters('vmssName'),'nic')]",
                                    "properties": {
                                        "primary": true,
                                        "ipConfigurations": [
                                            {
                                                "name": "[concat('ipconfigVmss', parameters('vmssName'))]",
                                                "properties": {
                                                    "subnet": {
                                                        "id": "[variables('vmssSubnetRef')]"
                                                    },
                                                    "loadBalancerBackendAddressPools": [
                                                        {
                                                            "id": "[concat(variables('publicLBID'), '/backendAddressPools/BackendPoolNode')]"
                                                        }
                                                    ],
                                                    "loadBalancerInboundNatPools": [
                                                        {
                                                            "id": "[concat(variables('publicLBID'), '/inboundNatPools/lbNAT-node')]"
                                                        }
                                                    ]
                                                }
                                            }
                                        ]
                                    }
                                }
                            ]
                        }
                    }
                }
            }
        ],
        "outputs": {
            "adminUsername": {
                "type": "String",
                "value": "[parameters('adminUsername')]"
            },
            "hostname": {
                "type": "String",
                "value": "[reference(variables('publicIPAddressName')).dnsSettings.fqdn]"
            },
            "sshCommand": {
                "type": "String",
                "value": "[concat('ssh ', parameters('adminUsername'), '@', reference(variables('publicIPAddressName')).dnsSettings.fqdn)]"
            }
        }
    }
    
    • 可以修改 master 和 node 的名字前缀、部署区域、数量和 VM 类型

      在这里插入图片描述

      • ssh 22 对外由 LB 配置 NAT 端口实现,如配置文件中 50200 → master-0
        • 已经包含的规则转换(不含 30880)

          服务协议规则后端端口前端端口节点池
          sshTCP入站 NAT2250200, 50201, 50202, 50100~50199主节点, 普通节点
          api 服务器TCP负载均衡64436443主节点
          ks 控制台TCP负载均衡3088030880主节点
          httpTCP负载均衡8080普通节点
          httpsTCP负载均衡443443普通节点
      • node 使用 VMSS
  • 部署 K8S cluster
    最简单的方式还是用 kk 完成,注意在 kubernetes 1.24 以后,psp 弃用,在 kk 中还有 psp 权限管理,安装的时候会报错。建议使用 1.23.10,也是 kk 现在默认的版本。

    • 证书传输 → Master-0

      scp  -i zyi.pem -P 50200 zyi.pem zyi@20.247.0.170:/home/zyi/.ssh/
      
      
    • 每一台安装 socat 等必须的软件

      ssh -i zyi.pem -p50200 zyi@20.247.0.170 'sudo apt install socat conntrack'
      
    • 登录到 Mater-0

      ssh -i zyi.pem -p50200 zyi@20.247.0.170
      
    • 下载 kk 并赋予可执行权限

    curl -sfL https://get-kk.kubesphere.io | VERSION=v3.0.10 sh -
    
    chmod +x kk
    
    • 创建配置文件模板

      ./kk create config --with-kubesphere v3.3.2 --with-kubernetes v1.22.12
      
      • KubeSphere 3.3 对应 Kubernetes 版本推荐:v1.20.x、v1.21.x、* v1.22.x、* v1.23.x 和 * v1.24.x。带星号的版本可能出现边缘节点部分功能不可用的情况。因此,如需使用边缘节点,推荐安装 v1.21.x。如果未指定 Kubernetes 版本,KubeKey 将默认安装 Kubernetes v1.23.10。有关支持的 Kubernetes 版本请参阅支持矩阵。

      • 如果在此步骤中的命令中未添加标志 -with-kubesphere,则不会部署 KubeSphere,除非您使用配置文件中的 addons 字段进行安装,或稍后使用 ./kk create cluster 时再次添加此标志。

      • 如果在未指定 KubeSphere 版本的情况下添加标志 --with kubesphere`,将安装 KubeSphere 的最新版本。

      • 修改的内容用红色标注

        apiVersion: kubekey.kubesphere.io/v1alpha2
        kind: Cluster
        metadata:
          name: kubeCluster
        spec:
          hosts:
          - {name: master-0, address: 20.210.0.156, port: 50200, internalAddress: 10.211.1.5, user: zyi, privateKeyPath: "~/.ssh/zyi.pem"}
          - {name: master-1, address: 20.210.0.156, port: 50201, internalAddress: 10.211.1.6, user: zyi, privateKeyPath: "~/.ssh/zyi.pem"}
          - {name: master-2, address: 20.210.0.156, port: 50202, internalAddress: 10.211.1.4, user: zyi, privateKeyPath: "~/.ssh/zyi.pem"}
          - {name: node000000, address: 20.210.0.156, port: 50100, internalAddress: 10.211.0.4, user: zyi, privateKeyPath: "~/.ssh/zyi.pem"}
          - {name: node000001, address: 20.210.0.156, port: 50101, internalAddress: 10.211.0.5, user: zyi, privateKeyPath: "~/.ssh/zyi.pem"}
          - {name: node000002, address: 20.210.0.156, port: 50102, internalAddress: 10.211.0.6, user: zyi, privateKeyPath: "~/.ssh/zyi.pem"}
          roleGroups:
            etcd:
            - master-0
            - master-1
            - master-2
            control-plane:
            - master-0
            - master-1
            - master-2
            worker:
            - node000000
            - node000001
            - node000002
          controlPlaneEndpoint:
            ## Internal loadbalancer for apiservers
            # internalLoadbalancer: haproxy
            domain: lb.etaon.lab
            address: "20.210.0.156"
            port: 6443
          kubernetes:
            version: v1.23.10
            clusterName: cluster.local
            autoRenewCerts: true
            containerManager: docker
          etcd:
            type: kubekey
          network:
            plugin: flannel
            kubePodsCIDR: 10.233.64.0/18
            kubeServiceCIDR: 10.233.0.0/18
            ## multus support. https://github.com/k8snetworkplumbingwg/multus-cni
            multusCNI:
              enabled: false
          registry:
            privateRegistry: ""
            namespaceOverride: ""
            registryMirrors: []
            insecureRegistries: []
          addons: []
        
        ---
        apiVersion: installer.kubesphere.io/v1alpha1
        kind: ClusterConfiguration
        metadata:
          name: ks-installer
          namespace: kubesphere-system
          labels:
            version: v3.3.2
        spec:
          persistence:
            storageClass: ""
          authentication:
            jwtSecret: ""
          zone: ""
          local_registry: ""
          namespace_override: ""
          # dev_tag: ""
          etcd:
            monitoring: false
            endpointIps: localhost
            port: 2379
            tlsEnable: true
          common:
            core:
              console:
                enableMultiLogin: true
                port: 30880
                type: NodePort
            # apiserver:
            #  resources: {}
            # controllerManager:
            #  resources: {}
            redis:
              enabled: false
              volumeSize: 2Gi
            openldap:
              enabled: false
              volumeSize: 2Gi
            minio:
              volumeSize: 20Gi
            monitoring:
              # type: external
              endpoint: http://prometheus-operated.kubesphere-monitoring-system.svc:9090
              GPUMonitoring:
                enabled: false
            gpu:
              kinds:
              - resourceName: "nvidia.com/gpu"
                resourceType: "GPU"
                default: true
            es:
              # master:
              #   volumeSize: 4Gi
              #   replicas: 1
              #   resources: {}
              # data:
              #   volumeSize: 20Gi
              #   replicas: 1
              #   resources: {}
              logMaxAge: 7
              elkPrefix: logstash
              basicAuth:
                enabled: false
                username: ""
                password: ""
              externalElasticsearchHost: ""
              externalElasticsearchPort: ""
          alerting:
            enabled: false
            # thanosruler:
            #   replicas: 1
            #   resources: {}
          auditing:
            enabled: false
            # operator:
            #   resources: {}
            # webhook:
            #   resources: {}
          devops:
            enabled: false
            # resources: {}
            jenkinsMemoryLim: 8Gi
            jenkinsMemoryReq: 4Gi
            jenkinsVolumeSize: 8Gi
          events:
            enabled: false
            # operator:
            #   resources: {}
            # exporter:
            #   resources: {}
            # ruler:
            #   enabled: true
            #   replicas: 2
            #   resources: {}
          logging:
            enabled: false
            logsidecar:
              enabled: true
              replicas: 2
              # resources: {}
          metrics_server:
            enabled: false
          monitoring:
            storageClass: ""
            node_exporter:
              port: 9100
              # resources: {}
            # kube_rbac_proxy:
            #   resources: {}
            # kube_state_metrics:
            #   resources: {}
            # prometheus:
            #   replicas: 1
            #   volumeSize: 20Gi
            #   resources: {}
            #   operator:
            #     resources: {}
            # alertmanager:
            #   replicas: 1
            #   resources: {}
            # notification_manager:
            #   resources: {}
            #   operator:
            #     resources: {}
            #   proxy:
            #     resources: {}
            gpu:
              nvidia_dcgm_exporter:
                enabled: false
                # resources: {}
          multicluster:
            clusterRole: none
          network:
            networkpolicy:
              enabled: false
            ippool:
              type: none
            topology:
              type: none
          openpitrix:
            store:
              enabled: false
          servicemesh:
            enabled: false
            istio:
              components:
                ingressGateways:
                - name: istio-ingressgateway
                  enabled: false
                cni:
                  enabled: false
          edgeruntime:
            enabled: false
            kubeedge:
              enabled: false
              cloudCore:
                cloudHub:
                  advertiseAddress:
                    - ""
                service:
                  cloudhubNodePort: "30000"
                  cloudhubQuicNodePort: "30001"
                  cloudhubHttpsNodePort: "30002"
                  cloudstreamNodePort: "30003"
                  tunnelNodePort: "30004"
                # resources: {}
                # hostNetWork: false
              iptables-manager:
                enabled: true
                mode: "external"
                # resources: {}
              # edgeService:
              #   resources: {}
          terminal:
            timeout: 600
        
    • 安装部署

      ./kk create cluster -f config-sample.yaml
      
      • 安装日志
      kubectl logs -n kubesphere-system $(kubectl get pod -n kubesphere-system -l 'app in (ks-install, ks-installer)' -o jsonpath='{.items[0].metadata.name}') -f
      
      #####################################################
      ###              Welcome to KubeSphere!           ###
      #####################################################
      
      Console: http://10.211.1.5:30880
      Account: admin
      Password: P@88w0rd
      NOTES:
        1. After you log into the console, please check the
           monitoring status of service components in
           "Cluster Management". If any service is not
           ready, please wait patiently until all components 
           are up and running.
        2. Please change the default password after login.
      
      #####################################################
      https://kubesphere.io             2023-08-11 03:31:56
      #####################################################
      
    • 在 LBer 上为 30880端口 配置规则并在 ASG 上 permit

      在这里插入图片描述

      在这里插入图片描述

    • http://hostip:30880

      在这里插入图片描述

  • 测试

    apiVersion: v1
    kind: Service
    metadata:
      name: hello-kubernetes
    spec:
      type: NodePort
      ports:
      - port: 80
        targetPort: 8080
      selector:
        app: hello-kubernetes
    ---
    apiVersion: apps/v1
    kind: Deployment
    metadata:
      name: hello-kubernetes
    spec:
      replicas: 3
      selector:
        matchLabels:
          app: hello-kubernetes
      template:
        metadata:
          labels:
            app: hello-kubernetes
        spec:
          containers:
          - name: hello-kubernetes
            image: paulbouwer/hello-kubernetes:1.5
            ports:
            - containerPort: 8080
            env:
            - name: MESSAGE
              value: I just deployed a PodVM on the Azure VM Cluster!!
    
    • 配置外部访问30596 → 80

      kubectl get svc
      NAME               TYPE        CLUSTER-IP      EXTERNAL-IP   PORT(S)        AGE
      hello-kubernetes   NodePort    10.233.31.158   <none>        80:30596/TCP   167m
      
    • 负载均衡上配置

      在这里插入图片描述

    • 访问前端 公网 IP 或 DNS 名称

      在这里插入图片描述

      在这里插入图片描述

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.coloradmin.cn/o/928126.html

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈,一经查实,立即删除!

相关文章

RecyclerView面试问答

RecycleView 和 ListView对比: 使用方法上 ListView:继承重写 BaseAdapter,自定义 ViewHolder 与 converView优化。 RecyclerView: 继承重写 RecyclerView.Adapter 与 RecyclerView.ViewHolder。设置 LayoutManager 来展示不同的布局样式 ViewHolder的编写规范化,ListVie…

【数仓建设系列之三】数仓建模方式及如何评估数仓完善性

【数仓建设系列之三】数仓建模方式及如何评估数仓完善性 上篇文章我们对数仓的分层架构及核心概念做了简单介绍&#xff0c;同时也指明DW层是数仓建模的核心层。本篇文章&#xff0c;将详细从常见的维度模型建设手段及如何评估数仓建设的完善性展开讨论。 一、数仓维度建模 ​…

Azure - AzCopy学习

使用 AzCopy 将本地数据迁移到云存储空间 azcopy login 创建存储账号 ./azcopy login --tenant-id 40242385-c249-4746-95dc-4a0b64d49dc5这里的—tenant-id 在下面的地方查看&#xff1a;目录 ID&#xff1b;需要拥有Storage Blob Data Owner 的权限账号下可能会有很多目录&am…

SMC_TRAFOF_5Axes (FB)_标准龙门5轴

正计算&#xff1a; 电机位置》空间位姿 的正计算。 用于图形5轴控件的展示。 刀具长度 [u] 【脉冲当量】 电机转1圈是5毫米 电机转1圈要50000脉冲 如果刀具长5毫米&#xff0c;那么刀具长度u50000脉冲当量 输入输出&#xff1a; X轴 Y轴 Z轴 A轴【绕z轴旋转】东南西北方…

SFTP和SCP:哪种才是企业文件传输的可靠选择

文件传输在企业发展和业务拓展中越来越重要。为了保证数据的安全和传输的效率&#xff0c;企业需要选择合适、安全且高效的文件传输方式。在这种情况下&#xff0c;SFTP和SCP成为了企业文件传输的热门选择。 本文将详细介绍SFTP和SCP的特点&#xff0c;以及它们如何成为企业文…

ubuntu学习(四)----文件写入操作编程

1、write函数的详解 ssize_t write(int fd,const void*buf,size_t count); 参数说明&#xff1a; fd:是文件描述符&#xff08;write所对应的是写&#xff0c;即就是1&#xff09; buf:通常是一个字符串&#xff0c;需要写入的字符串 count&#xff1a;是每次写入的字节数…

【学习FreeRTOS】第19章——FreeRTOS低功耗模式Tickless

1.低功耗模式简介 很多应用场合对于功耗的要求很严格&#xff0c;比如可穿戴低功耗产品、物联网低功耗产品等一般MCU都有相应的低功耗模式&#xff0c;裸机开发时可以使用MCU的低功耗模式。FreeRTOS也提供了一个叫Tickless的低功耗模式&#xff0c;方便带FreeRTOS操作系统的应…

每日汇评:由于鲍威尔鹰派的讲话,黄金可能重新回到 1900 美元区域

1、金价暂停了四天的上涨趋势&#xff0c;但有望创下六周以来最好的一周&#xff1b; 2、在鲍威尔在杰克逊霍尔研讨会上发表讲话之前&#xff0c;美元恢复平静&#xff1b; 3、在 RSI 看跌的情况下&#xff0c;金价与 21 日移动平均线阻力位 1919 美元作斗争&#xff1b; 金…

免费PPT素材网站,我推荐这6个

找PPT素材、模板&#xff0c;就上这6个网站&#xff0c;免费下载&#xff0c;建议收藏~ 菜鸟图库 https://www.sucai999.com/search/ppt/0_0_0_1.html?vNTYwNDUx 菜鸟图库网有非常丰富的免费素材&#xff0c;像设计类、办公类、自媒体类等素材都很丰富。PPT模板种类很多&…

适配小程序隐私保护指引设置

由于小程序发布了一个公告&#xff0c;那么接下来就是怎么改简单的问题了。毕竟不太想大的改动历史上的代码。尽量简单的适配隐私策略就可以了。 整体思路也是参考现在App普遍的启动就让用户同意隐私策略&#xff0c;不同意不让用&#xff0c;同意了之后才能够继续使用。 公告…

英伟达挖走小鹏汽车高管吴新宙!何小鹏亲自送行 | 百能云芯

8月25日消息&#xff0c;英伟达公司挖来小鹏汽车自动驾驶副总裁吴新宙&#xff0c;任命他为自动驾驶产品主管&#xff0c;该职位将于8月25日正式生效。 据悉&#xff0c;小鹏汽车董事长何小鹏在个人微博上晒出了一张与吴新宙以及英伟达CEO黄仁勋的合影&#xff0c;并透露即将展…

访学、博后参考|加拿大十大名校简介

上期我们介绍了加拿大各省所在大学的分布情况&#xff0c;本期知识人网小编整理出加拿大十大名校简介&#xff0c;供申请者参考。 1、多伦多大学&#xff08;University of Toronto&#xff09;&#xff08;University of Toronto&#xff09;&#xff08;University of Toront…

最新绕过目标域名CDN进行信息收集技术

绕过目标域名CDN进行信息收集 1&#xff0e;CDN简介及工作流程 CDN&#xff08;Content Delivery Network&#xff0c;内容分发网络&#xff09;的目的是通过在现有的网络架构中增加一层新的Cache&#xff08;缓存&#xff09;层&#xff0c;将网站的内容发布到最接近用户的网…

一次harbor升级导致镜像项目访问无权限问题

一、问题背景 将环境中现运行的harbor版本升级到2.6.2版本&#xff0c;相关同事升级完&#xff0c;发现有部分镜像项目点进去报无权限问题&#xff0c;镜像项目无法使用&#xff0c;但是也有部分项目是可以正常提供使用的。 二、问题处理过程 1、根据报错反馈没权限&#xff…

Thinkphp内核微信拼团购物商城小程序源码

Thinkphp内核开发的微信拼团购物商城小程序源码&#xff0c;支持微信支付&#xff0c;站长亲测完美。 下载地址&#xff1a;https://bbs.csdn.net/topics/616764816

电脑文件删除了可以找回吗?分享一种简单恢复删除电脑文件办法!

电脑文件删除了可以找回吗&#xff1f;可以。在原理上讲电脑删除的文件是有希望恢复的&#xff0c;因为操作系统在删除文件的时候并会不会立刻将文件彻底删除。当文件被删除的时候&#xff0c;其文件记录被删除&#xff0c;并且被文件占用的磁盘空间被标记为空闲。 这样对于用户…

【HCIP】16.MPLS LDP

LDP是MPLS的一种控制协议&#xff0c;相当于传统网络中的信令协议&#xff0c;负责FEC的分类、标签的分配以及LSP的建立和维护等操作。LDP规定了标签分发过程中的各种消息以及相关处理过程。 LDP的工作过程主要分为两部分&#xff1a; LSR之间建立LDP会话。LSR之间基于LDP会话…

半导体低压热氧工艺中的真空度精密控制解决方案

摘要&#xff1a;在目前的各种半导体材料热氧化工艺中&#xff0c;往往需要对正负压力进行准确控制并对温度变化做出快速的响应&#xff0c;为此本文提出了热氧化工艺的正负压力控制解决方案。解决方案的核心是基于动态平衡法分别对进气和排气流量进行快速调节&#xff0c;具体…

Java——一个Java实体类,表示一个试题的模型

这段代码是一个Java实体类&#xff0c;表示一个试题的模型。 该实体类具有以下属性&#xff1a; id&#xff1a;题号&#xff0c;表示试题的编号。title&#xff1a;题目&#xff0c;表示试题的题目内容。optionA&#xff1a;选项A&#xff0c;表示试题的选项A。optionB&#…

【智算中心】GPU是如何改变世界的

现在有市场消息表示&#xff0c;NVIDIA正计划减少A800 GPU的产量&#xff0c;以促进其更高端的H800 GPU 的销售。很显然NVIDIA是希望从H800 GPU上获得更多销售量&#xff0c;从中国市场获得更多利益。而且最近一段时间有传闻美国要彻底封杀AI芯片的出口&#xff0c;让国内甚至连…