版本“2019-12-01”中没有类型 Microsoft.ContainerInstance/containerGroups 的匹配项

No matches for kind Microsoft.ContainerInstance/containerGroups in version "2019-12-01"

我正在使用 Azure 云。 我想在将容器日志推送到 Azure loganalytics.But 之前将其推送到我现有的 Azure 运行ning 容器,我想从 https://docs.microsoft.com/en-us/azure/container-instances/container-instances-log-analytics 尝试下面的 yaml :

apiVersion: 2019-12-01
location: eastus
name: mycontainergroup001
properties:
  containers:
  - name: mycontainer001
    properties:
      environmentVariables: []
      image: fluent/fluentd
      ports: []
      resources:
        requests:
          cpu: 1.0
          memoryInGB: 1.5
  osType: Linux
  restartPolicy: Always
  diagnostics:
    logAnalytics:
      workspaceId: LOG_ANALYTICS_WORKSPACE_ID
      workspaceKey: LOG_ANALYTICS_WORKSPACE_KEY
tags: null
type: Microsoft.ContainerInstance/containerGroups

我正在尝试通过执行 kubectl apply -f deploy-aci.yaml 在 AKS 集群中 运行 上面的 yaml。 我收到以下错误: 错误:无法识别“.\deploy-aci.yaml”:版本“2019-12-01”

中种类“Microsoft.ContainerInstance/containerGroups”没有匹配项

API 资源:

 kubectl api-resources
NAME                                     SHORTNAMES    APIVERSION                             NAMESPACED   KIND
bindings                                               v1                                     true         Binding        
componentstatuses                        cs            v1                                     false        ComponentStatus
configmaps                               cm            v1                                     true         ConfigMap      
endpoints                                ep            v1                                     true         Endpoints      
events                                   ev            v1                                     true         Event
limitranges                              limits        v1                                     true         LimitRange
namespaces                               ns            v1                                     false        Namespace 
nodes                                    no            v1                                     false        Node
persistentvolumeclaims                   pvc           v1                                     true         PersistentVolumeClaim
persistentvolumes                        pv            v1                                     false        PersistentVolume     
pods                                     po            v1                                     true         Pod
podtemplates                                           v1                                     true         PodTemplate
replicationcontrollers                   rc            v1                                     true         ReplicationController
resourcequotas                           quota         v1                                     true         ResourceQuota        
secrets                                                v1                                     true         Secret
serviceaccounts                          sa            v1                                     true         ServiceAccount
services                                 svc           v1                                     true         Service
mutatingwebhookconfigurations                          admissionregistration.k8s.io/v1        false        MutatingWebhookConfiguration
validatingwebhookconfigurations                        admissionregistration.k8s.io/v1        false        ValidatingWebhookConfiguration
customresourcedefinitions                crd,crds      apiextensions.k8s.io/v1                false        CustomResourceDefinition  
apiservices                                            apiregistration.k8s.io/v1              false        APIService
controllerrevisions                                    apps/v1                                true         ControllerRevision        
daemonsets                               ds            apps/v1                                true         DaemonSet
deployments                              deploy        apps/v1                                true         Deployment
replicasets                              rs            apps/v1                                true         ReplicaSet
statefulsets                             sts           apps/v1                                true         StatefulSet
tokenreviews                                           authentication.k8s.io/v1               false        TokenReview
localsubjectaccessreviews                              authorization.k8s.io/v1                true         LocalSubjectAccessReview  
selfsubjectaccessreviews                               authorization.k8s.io/v1                false        SelfSubjectAccessReview   
selfsubjectrulesreviews                                authorization.k8s.io/v1                false        SelfSubjectRulesReview    
subjectaccessreviews                                   authorization.k8s.io/v1                false        SubjectAccessReview
horizontalpodautoscalers                 hpa           autoscaling/v1                         true         HorizontalPodAutoscaler
cronjobs                                 cj            batch/v1                               true         CronJob
jobs                                                   batch/v1                               true         Job
certificatesigningrequests               csr           certificates.k8s.io/v1                 false        CertificateSigningRequest
configs                                  config        config.gatekeeper.sh/v1alpha1          true         Config
k8sazureallowedcapabilities                            constraints.gatekeeper.sh/v1beta1      false        K8sAzureAllowedCapabilities
k8sazureallowedusersgroups                             constraints.gatekeeper.sh/v1beta1      false        K8sAzureAllowedUsersGroupsk8sazureblockautomounttoken                            constraints.gatekeeper.sh/v1beta1      false        K8sAzureBlockAutomountToken
k8sazureblockdefault                                   constraints.gatekeeper.sh/v1beta1      false        K8sAzureBlockDefault
k8sazureblockhostnamespace                             constraints.gatekeeper.sh/v1beta1      false        K8sAzureBlockHostNamespacek8sazurecontainerallowedimages                         constraints.gatekeeper.sh/v1beta1      false        K8sAzureContainerAllowedImages
k8sazurecontainerlimits                                constraints.gatekeeper.sh/v1beta1      false        K8sAzureContainerLimits
k8sazurecontainernoprivilege                           constraints.gatekeeper.sh/v1beta1      false        K8sAzureContainerNoPrivilege
k8sazurecontainernoprivilegeescalation                 constraints.gatekeeper.sh/v1beta1      false        K8sAzureContainerNoPrivilegeEscalation
k8sazuredisallowedcapabilities                         constraints.gatekeeper.sh/v1beta1      false        K8sAzureDisallowedCapabilities
k8sazureenforceapparmor                                constraints.gatekeeper.sh/v1beta1      false        K8sAzureEnforceAppArmor   
k8sazurehostfilesystem                                 constraints.gatekeeper.sh/v1beta1      false        K8sAzureHostFilesystem
k8sazurehostnetworkingports                            constraints.gatekeeper.sh/v1beta1      false        K8sAzureHostNetworkingPorts
k8sazureingresshttpsonly                               constraints.gatekeeper.sh/v1beta1      false        K8sAzureIngressHttpsOnly
k8sazurereadonlyrootfilesystem                         constraints.gatekeeper.sh/v1beta1      false        K8sAzureReadOnlyRootFilesystem
k8sazureserviceallowedports                            constraints.gatekeeper.sh/v1beta1      false        K8sAzureServiceAllowedPorts
leases                                                 coordination.k8s.io/v1                 true         Lease
endpointslices                                         discovery.k8s.io/v1                    true         EndpointSlice
events                                   ev            events.k8s.io/v1                       true         Event
ingresses                                ing           extensions/v1beta1                     true         Ingress
flowschemas                                            flowcontrol.apiserver.k8s.io/v1beta1   false        FlowSchema
prioritylevelconfigurations                            flowcontrol.apiserver.k8s.io/v1beta1   false        PriorityLevelConfigurationingressclasses                                         networking.k8s.io/v1                   false        IngressClass
networkpolicies                          netpol        networking.k8s.io/v1                   true         NetworkPolicy
runtimeclasses                                         node.k8s.io/v1                         false        RuntimeClass
poddisruptionbudgets                     pdb           policy/v1                              true         PodDisruptionBudget       
podsecuritypolicies                      psp           policy/v1beta1                         false        PodSecurityPolicy
clusterrolebindings                                    rbac.authorization.k8s.io/v1           false        ClusterRoleBinding        
clusterroles                                           rbac.authorization.k8s.io/v1           false        ClusterRole
rolebindings                                           rbac.authorization.k8s.io/v1           true         RoleBinding
priorityclasses                          pc            scheduling.k8s.io/v1                   false        PriorityClass
secretproviderclasses                                  secrets-store.csi.x-k8s.io/v1          true         SecretProviderClass       
secretproviderclasspodstatuses                         secrets-store.csi.x-k8s.io/v1          true         SecretProviderClassPodStatus
volumesnapshotclasses                                  snapshot.storage.k8s.io/v1             false        VolumeSnapshotClass       
volumesnapshotcontents                                 snapshot.storage.k8s.io/v1             false        VolumeSnapshotContent     
volumesnapshots                                        snapshot.storage.k8s.io/v1             true         VolumeSnapshot
constraintpodstatuses                                  status.gatekeeper.sh/v1beta1           true         ConstraintPodStatus       
constrainttemplatepodstatuses                          status.gatekeeper.sh/v1beta1           true         ConstraintTemplatePodStatus
csidrivers                                             storage.k8s.io/v1                      false        CSIDriver
csinodes                                               storage.k8s.io/v1                      false        CSINode
csistoragecapacities                                   storage.k8s.io/v1beta1                 true         CSIStorageCapacity        
storageclasses                           sc            storage.k8s.io/v1                      false        StorageClass
volumeattachments                                      storage.k8s.io/v1                      false        VolumeAttachment
constrainttemplates                      constraints   templates.gatekeeper.sh/v1             false        ConstraintTemplate

在上述 apiresources 中,我可以使用其中任何一个可以执行 deploy-aci.yaml.

我的kubernetes版本是1.21.7.

此 YAML 不会被执行 运行 在 AKS 集群中 kubectl apply -f deploy-aci.yaml。您必须更改 YAML 代码才能使其在 AKS 上 运行。

供您参考,此 YAML 代码专门为创建 Azure 容器实例并将容器的日志存储在 Log Analytics WorkSpace 中而编写。

同样对于 AKS,默认情况下在创建 AKS.So 时创建的 Log Analytics WorkSpace 存储了 pods/conatainer 的所有日志,您不需要创建另一个工作区来存储日志。

因此,尽管 运行ning kubectl apply -f deploy-aci.yaml cmdlet 请 运行 az container create --resource-group myResourceGroup --name mycontainergroup001 --file deploy-aci.yaml MS 文档中给出的此 cmdlet。

我也 运行 相同的命令,它 运行 成功并创建了一个容器实例。