github.com/GoogleContainerTools/skaffold/v2@v2.13.2/docs-v2/design_proposals/kaniko-proxy-setting.md (about)

     1  # Title
     2  
     3  * Author(s): Prashant Arya
     4  * Design Shepherd: Tejal Desai
     5  * Date: 3rd April 2018
     6  * Status:  Approved/
     7  
     8  ## Background
     9  
    10  At present if you run skaffold in seperate lab environment without direct internet access, skaffold command with kaniko builds fail. This is because, kaniko spins up a seperate pod which do not have the proxy information set. 
    11  
    12  To overcome this problem we can add proxy environment setting to kaniko config section to plumb it through to kaniko pod config.
    13   
    14  Here is an example of new kaniko Pod config will look like with http proxy information.
    15  
    16  ___
    17  Setting proxy variable in pod definition 
    18  ```yaml
    19  Containers: []v1.Container{
    20                  {
    21                      Name:            constants.DefaultKanikoContainerName,
    22                      Image:           image,
    23                      Args:            args,
    24                      ImagePullPolicy: v1.PullIfNotPresent,
    25                      Env: []v1.EnvVar{
    26                          {
    27                          Name:  "GOOGLE_APPLICATION_CREDENTIALS",
    28                          Value: "/secret/kaniko-secret",
    29                          }
    30                          {
    31                          Name:  "http_proxy",
    32                          Value: "somevalue",
    33                          }
    34                          {
    35                          Name:  "https_proxy",
    36                          Value: "somevalue",
    37                          }
    38                      },
    39                  },
    40  ```
    41  Setting the proxy would give kaniko pod internet access. Where it can contact gcr or linux update server(any install command).
    42  ___
    43  
    44  ## Design
    45  We will be adding 2 new config variables in `ClusterDetails` config section.
    46  For a new config change, please mention:
    47  
    48    
    49  ```yaml
    50  // ClusterDetails *beta* describes how to do an on-cluster build.
    51  type ClusterDetails struct {
    52      
    53      // HTTP_PROXY sets the "http_proxy" environment variable to the pod running cluster build.      
    54      HTTP_PROXY string `yaml:"httpProxy,omitempty"`
    55  
    56      // HTTPS_PROXY sets the "https_proxy" environment variable to the pod running cluster build. 
    57      HTTPS_PROXY string `yaml:"httpsProxy,omitempty"`
    58      
    59      // PullSecret is the path to the secret key file.
    60      PullSecret string `yaml:"pullSecret,omitempty"`
    61  
    62      // PullSecretName is the name of the Kubernetes secret for pulling the files
    63      // from the build context and pushing the final image.
    64      // Defaults to `kaniko-secret`.
    65      PullSecretName string `yaml:"pullSecretName,omitempty"`
    66  
    67      // Namespace is the Kubernetes namespace.
    68      // Defaults to current namespace in Kubernetes configuration.
    69      Namespace string `yaml:"namespace,omitempty"`
    70  
    71      // Timeout is the amount of time (in seconds) that this build is allowed to run.
    72      // Defaults to 20 minutes (`20m`).
    73      Timeout string `yaml:"timeout,omitempty"`
    74  
    75      // DockerConfig describes how to mount the local Docker configuration into a pod.
    76      DockerConfig *DockerConfig `yaml:"dockerConfig,omitempty"`
    77  
    78      // Resources define the resource requirements for the kaniko pod.
    79      Resources *ResourceRequirements `yaml:"resources,omitempty"`
    80  }
    81  
    82  ```
    83  
    84  ### Open Issues/Question
    85  #2163
    86  
    87  
    88  **\<Question\>**
    89  
    90  Do we need to set proxy for other builders as well?
    91  
    92  Resolution: No. As of now we don't have anyother cluster builder.
    93  
    94  ## Implementation plan
    95  ___
    96  
    97  1. Add new field to cluster struct
    98  2. Add logic to put all the environment variable in collection
    99  3. Pass the collection to kaniko pod definition 
   100  ___