0

I want to set the loggingService field of an existing container.v1.cluster through deployment-manager. I have the following config

resources:                                                                      
- name: px-cluster-1                                                            
  type: container.v1.cluster                                                    
  properties:                                                                   
    zone: europe-west1-b                                                        
    cluster:                                                                    
      description: "dev cluster"                                                
      initialClusterVersion: "1.13"                                             
      nodePools:                                                                
        - name: cluster-pool                                                    
          config:                                                               
            machineType: "n1-standard-1"                                        
            oauthScopes:                                                        
            - https://www.googleapis.com/auth/compute                           
            - https://www.googleapis.com/auth/devstorage.read_only              
            - https://www.googleapis.com/auth/logging.write                     
            - https://www.googleapis.com/auth/monitoring                        
          management:                                                           
            autoUpgrade: true                                                   
            autoRepair: true                                                    
          initialNodeCount: 1                                                   
          autoscaling:                                                          
            enabled: true                                                       
            minNodeCount: 3                                                     
            maxNodeCount: 10                                                    
      ipAllocationPolicy:                                                       
        useIpAliases: true                                                      
      loggingService: "logging.googleapis.com/kubernetes"                       
      masterAuthorizedNetworksConfig:                                           
        enabled: false                                
      locations:                                                                
        - "europe-west1-b"                                                      
        - "europe-west1-c"

When I try to run gcloud deployment-manager deployments update ..., I get the following error

ERROR: (gcloud.deployment-manager.deployments.update) Error in Operation [operation-1582040492957-59edb819a5f3c-7155f798-5ba37285]: errors:
- code: NO_METHOD_TO_UPDATE_FIELD
  message: No method found to update field 'cluster' on resource 'px-cluster-1' of
    type 'container.v1.cluster'. The resource may need to be recreated with the new
    field.

The same succeeds if I remove loggingService.

Is there a way to update loggingService using deployment-manager without deleting the cluster?

1 Answers1

1

The error NO_METHOD_TO_UPDATE_FIELD is due to updating "initialClusterVersion" when you issued the update call to GKE. This field is only used on creation of the cluster, and the type definition doesn't currently allow for it to be updated later. So that should remain static at the original value and will have no effect on the deployment moving forward or try to delete/comment that line.

Even when the previous entry is true, there is also no method to update the logging service, actually Deployment Manager doesn't have many update methods, so, try using the gcloud command to update the cluster directly, keep in mind that you have to use the monitoring service together with the logging service, so, the commando would look like:

gcloud container clusters update px-cluster-1 --logging-service=logging.googleapis.com/kubernetes --monitoring-service=monitoring.googleapis.com/kubernetes --zone=europe-west1-b

AdolfoOG
  • 186
  • 7