How to disable istio on K8S job

12/8/2019

I am running K8S version 1.15.3 I am trying to install istio1.4 on my k8s cluster.

I am using k8s jobs for some of my automation during the installation. one of those jobs is doing some calls to kubernetes api using python and this is failing when using istio. I am guessing istio is somehow blocking access to kubernetes api.

How can I remove istio from specific jobs?

I saw this annotation: sidecar.istio.io/inject: "false" and I tried adding it to my job manifest but istio is still adding the sidecar when this annotation exists.

The Error from the job is:

2019-12-08 13:22:08,009 WARNING Retrying (Retry(total=2, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<urllib3.connection.VerifiedHTTPSConnection object at 0x7f45c0c0a390>: Failed to establish a new connection: [Errno 111] Connection refused',)': /api/v1/pods?watch=False
2019-12-08 13:22:08,009 WARNING Retrying (Retry(total=1, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<urllib3.connection.VerifiedHTTPSConnection object at 0x7f45c0c0a4d0>: Failed to establish a new connection: [Errno 111] Connection refused',)': /api/v1/pods?watch=False
2019-12-08 13:22:08,010 WARNING Retrying (Retry(total=0, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<urllib3.connection.VerifiedHTTPSConnection object at 0x7f45c0c0a650>: Failed to establish a new connection: [Errno 111] Connection refused',)': /api/v1/pods?watch=False
Traceback (most recent call last):
  File "./get_pod_regex_exec.py", line 19, in <module>
    ret = v1.list_pod_for_all_namespaces(watch=False)
  File "/usr/local/lib/python2.7/site-packages/kubernetes/client/apis/core_v1_api.py", line 13630, in list_pod_for_all_namespaces
    (data) = self.list_pod_for_all_namespaces_with_http_info(**kwargs)
  File "/usr/local/lib/python2.7/site-packages/kubernetes/client/apis/core_v1_api.py", line 13724, in list_pod_for_all_namespaces_with_http_info
    collection_formats=collection_formats)
  File "/usr/local/lib/python2.7/site-packages/kubernetes/client/api_client.py", line 334, in call_api
    _return_http_data_only, collection_formats, _preload_content, _request_timeout)
  File "/usr/local/lib/python2.7/site-packages/kubernetes/client/api_client.py", line 168, in __call_api
    _request_timeout=_request_timeout)
  File "/usr/local/lib/python2.7/site-packages/kubernetes/client/api_client.py", line 355, in request
    headers=headers)
  File "/usr/local/lib/python2.7/site-packages/kubernetes/client/rest.py", line 231, in GET
    query_params=query_params)
  File "/usr/local/lib/python2.7/site-packages/kubernetes/client/rest.py", line 205, in request
    headers=headers)
  File "/usr/local/lib/python2.7/site-packages/urllib3/request.py", line 76, in request
    method, url, fields=fields, headers=headers, **urlopen_kw
  File "/usr/local/lib/python2.7/site-packages/urllib3/request.py", line 97, in request_encode_url
    return self.urlopen(method, url, **extra_kw)
  File "/usr/local/lib/python2.7/site-packages/urllib3/poolmanager.py", line 330, in urlopen
    response = conn.urlopen(method, u.request_uri, **kw)
  File "/usr/local/lib/python2.7/site-packages/urllib3/connectionpool.py", line 762, in urlopen
    **response_kw
  File "/usr/local/lib/python2.7/site-packages/urllib3/connectionpool.py", line 762, in urlopen
    **response_kw
  File "/usr/local/lib/python2.7/site-packages/urllib3/connectionpool.py", line 762, in urlopen
    **response_kw
  File "/usr/local/lib/python2.7/site-packages/urllib3/connectionpool.py", line 720, in urlopen
    method, url, error=e, _pool=self, _stacktrace=sys.exc_info()[2]
  File "/usr/local/lib/python2.7/site-packages/urllib3/util/retry.py", line 436, in increment
    raise MaxRetryError(_pool, url, error or ResponseError(cause))
urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host='10.233.0.1', port=443): Max retries exceeded with url: /api/v1/pods?watch=False (Caused by NewConnectionError('<urllib3.connection.VerifiedHTTPSConnection object at 0x7f45c0c0a790>: Failed to establish a new connection: [Errno 111] Connection refused',))

How can I remove istio from this job or tell it to not block access to k8s api? thanks

-- eran meiri
istio
kubernetes

1 Answer

12/9/2019

I found an answer for my question :) Inside the template I put those values:

spec:
  template:
    metadata:
      annotations:
        sidecar.istio.io/inject: "false"
-- eran meiri
Source: StackOverflow