K8S cluster with multi-masters on Azure VM

拓扑参考:

在这里插入图片描述

在 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 名称

      在这里插入图片描述

      在这里插入图片描述

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

如若内容造成侵权/违法违规/事实不符,请联系我们进行投诉反馈qq邮箱809451989@qq.com,一经查实,立即删除!

相关文章

【Hello Network】DNS协议 NAT技术 代理服务器

本篇博客简介&#xff1a;介绍DNS协议 NAT技术和代理服务器 网络各协议补充 DNSDNS背景DNS介绍DNS总结域名简介 NAT技术NAT技术背景NAT IP转换过程NAPTNAT技术缺陷NAT和代理服务器 网络协议总结应用层传输层网络层数据链路层 DNS DNS是一整套从域名映射到IP的系统 DNS背景 为…

【WSN无线传感器网络恶意节点】使用 MATLAB 进行无线传感器网络部署研究

&#x1f4a5;&#x1f4a5;&#x1f49e;&#x1f49e;欢迎来到本博客❤️❤️&#x1f4a5;&#x1f4a5; &#x1f3c6;博主优势&#xff1a;&#x1f31e;&#x1f31e;&#x1f31e;博客内容尽量做到思维缜密&#xff0c;逻辑清晰&#xff0c;为了方便读者。 ⛳️座右铭&a…

提速换挡 | 至真科技用技术打破业务壁垒,助力出海破局增长

各个行业都在谈出海&#xff0c;但真正成功的又有多少&#xff1f; 李宁出海十年海外业务收入占比仅有1.3%&#xff0c;走出去战略基本失败。 京东出海业务磕磕绊绊&#xff0c;九年过去国际化业务至今在财报上都不配拥有姓名。 几百万砸出去买量&#xff0c;一点水花都没有…

从零开始的Hadoop学习(二)| Hadoop介绍、优势、组成、HDFS架构

1. Hadoop 是什么 Hadoop是一个由Apache基金会所开发的分布式系统基础架构。主要解决&#xff0c;海量数据的存储和海量数据的分析计算问题。广义上来说&#xff0c;Hadoop通常是指一个更广泛的概念—Hadoop生态圈。 2. Hadoop 的优势 高可靠性&#xff1a;Hadoop底层维护多…

开源项目的社区建设与管理

&#x1f337;&#x1f341; 博主猫头虎 带您 Go to New World.✨&#x1f341; &#x1f984; 博客首页——猫头虎的博客&#x1f390; &#x1f433;《面试题大全专栏》 文章图文并茂&#x1f995;生动形象&#x1f996;简单易学&#xff01;欢迎大家来踩踩~&#x1f33a; &a…

pytestx容器化执行引擎

系统架构 前端、后端、pytest均以Docker容器运行服务&#xff0c;单独的容器化执行引擎&#xff0c;项目环境隔离&#xff0c;即用即取&#xff0c;用完即齐&#xff0c;简单&#xff0c;高效。 前端容器&#xff1a;页面交互&#xff0c;请求后端&#xff0c;展示HTML报告 后…

在 AWS 中导入 qcow2 镜像

文章目录 在 AWS 中导入 qcow2 镜像使用的格式和问题步骤概述前提条件转换镜像格式并上传至 S3创建角色并配置策略策略文件内容创建container.json配置文件导入镜像创建 AMI 并启动实例参考:在 AWS 中导入 qcow2 镜像 当我们在多云环境中部署应用时,有时候可能需要把基于 qem…

python进行数据分析:数据预处理

六大数据类型 见python基本功 import numpy as np import pandas as pd数据预处理 缺失值处理 float_data pd.Series([1.2, -3.5, np.nan, 0]) float_data0 1.2 1 -3.5 2 NaN 3 0.0 dtype: float64查看缺失值 float_data.isna()0 False 1 …

vue 简单实验 自定义组件 局部注册

1.概要 2.代码 <html> </html> <script src"https://unpkg.com/vuenext" rel"external nofollow" ></script> <body><div id"counter"><component-a></component-a></div> </body&g…

海运费查询国际海运费知识-箱讯科技

在国际贸易中&#xff0c;海运是一种常见且重要的货物运输方式。了解海运费用及其查询方法以及国际海运费的相关知识对于进出口商和物流从业人员来说至关重要。本文将介绍海运费查询的方法和国际海运费的相关知识&#xff0c;帮助读者更好地理解和应用于实际业务中。 一、海运费…

CSS中如何实现多列布局?

聚沙成塔每天进步一点点 ⭐ 专栏简介⭐ 多列布局&#xff08;Multi-column Layout&#xff09;⭐ column-count⭐ column-width⭐ column-gap⭐ column-rule⭐ column-span⭐ 示例⭐ 写在最后 ⭐ 专栏简介 前端入门之旅&#xff1a;探索Web开发的奇妙世界 记得点击上方或者右侧…

Linux--线程地址空间

1.程序地址空间 先来就看这张图 这是一张程序地址分布的图&#xff0c;通过一段代码来证明地址空间的分布情况 编译结果&#xff1a; 可以看出的是&#xff0c;父子进程中对于同一个变量打印的地址是一样的&#xff0c;这是因为子进程以父进程为模板&#xff0c;因为都没有对数…

工具--录屏软件

记录下录屏软件 ScreenToGif 官网 &#xff1a;https://www.screentogif.com/downloads 我下载的是 Installer 版本。 录屏&#xff0c;默认输出为 gif 。录制的 gif 清晰&#xff0c;且容量低。需要录gif的话主推&#xff01; 录制后输出为 mp4 的话提示要下载 FFmpeg &a…

Mainline Linux 和 U-Boot编译

By Toradex胡珊逢 Toradex 自从 Linux BSP v6 开始在使用 32位处理器的 Arm 模块如 iMX6、iMX6ULL、iMX7 上提供 mainline/upstream kernel &#xff0c;部分 64位处理器模块如 Verdin iMX8M Mini/Plus 也提供实验性支持。文章将以季度发布版本 Linux BSP V6.3.0 为例介绍如何下…

GE 8920-PS-DC安全模块

安全控制&#xff1a; 这个安全模块通常用于实现工业自动化系统中的安全控制功能。它可以监测各种安全参数&#xff0c;如机器运动、温度、压力等&#xff0c;以确保系统在安全范围内运行。 PLC兼容性&#xff1a; 通常&#xff0c;这种安全模块可以与可编程逻辑控制器&#x…

Docker安装与部署java项目

文章目录 Docker安装与部署java项目 用的宝塔服务器查看容器命令部署 java 项目这是别人用的 用这个要保证 自己docker 有 jdk1.8这个是我自己的 宝塔安装的 jdk1.8 注意 需要把 jshepr 替换成自己的 jar 名字 要小写下面命令有关于 jshepr 都要改成 上面写地自己的jar3&#x…

WPF读取dicom序列:实现上一帧、下一帧、自动播放、暂停

一、整体设计概况 创建WPF程序使用.Net Framework4.8定义Image控件展示图像增加标签展示dcm文件信息规划按钮触发对应的事件:上一帧、下一帧、自动播放、暂停、缩放、播放速率二、页面展示 三、代码逻辑分析 Windows窗体加载Loaded事件:生成初始图像信息Windows窗体加载Mous…

矢量调制分析基础

前言 本文介绍VSA 的矢量调制分析和数字调制分析测量能力。某些扫频调谐频谱分析仪也能通过使用另外的数字无线专用软件来提供数字调制分析。然而&#xff0c;VSA 通常在调制格式和解调算法配置等方面提供更大的测量灵活性&#xff0c;并提供更多的数据结果和轨迹轨迹显示。本…

八月更新 | CI 构建计划触发机制升级、制品扫描 SBOM 分析功能上线!

点击链接了解详情 这个八月&#xff0c;腾讯云 CODING DevOps 对持续集成、制品管理、项目协同、平台权限等多个产品模块进行了升级改进&#xff0c;为用户提供更灵活便捷的使用体验。以下是 CODING 新功能速递&#xff0c;快来看看是否有您期待已久的功能特性&#xff1a; 01…

【衍射光栅】用于Matlab的交互式衍射光栅模型研究

&#x1f4a5;&#x1f4a5;&#x1f49e;&#x1f49e;欢迎来到本博客❤️❤️&#x1f4a5;&#x1f4a5; &#x1f3c6;博主优势&#xff1a;&#x1f31e;&#x1f31e;&#x1f31e;博客内容尽量做到思维缜密&#xff0c;逻辑清晰&#xff0c;为了方便读者。 ⛳️座右铭&a…