Tedezed/kubernetes-containers-tools

autoscaler pod is not running , status `CrashLoopBackOff`

saikatharryc opened this issue · 5 comments

command kubectl create -f ./autoscale.yaml --namespace experimental

  Type     Reason                 Age              From                                                Message
  ----     ------                 ----             ----                                                -------
  Normal   Scheduled              3m               default-scheduler                                   Successfully assigned statefull-autoscaler-fgfc5 to ip-xxx-xx-37-5.us-west-2.compute.internal
  Normal   SuccessfulMountVolume  3m               kubelet, ip-xxx-xx-37-5.us-west-2.compute.internal  MountVolume.SetUp succeeded for volume "statefull-autoscaler-token-rv5ls"
  Normal   Pulled                 2m (x4 over 3m)  kubelet, ip-xxx-xx-37-5.us-west-2.compute.internal  Successfully pulled image "tedezed/slug-statefulset-autoscaler:latest"
  Normal   Created                2m (x4 over 3m)  kubelet, ip-xxx-xx-37-5.us-west-2.compute.internal  Created container
  Normal   Started                2m (x4 over 3m)  kubelet, ip-xxx-xx-37-5.us-west-2.compute.internal  Started container
  Warning  BackOff                2m (x7 over 3m)  kubelet, ip-xxx-xx-37-5.us-west-2.compute.internal  Back-off restarting failed container
  Normal   Pulling                2m (x5 over 3m)  kubelet, ip-xxx-xx-37-5.us-west-2.compute.internal  pulling image "tedezed/slug-statefulset-autoscaler:latest"

I need more information, logs, versions of Kubernetes, etc.

versions:

➜  kube kubectl version
Client Version: version.Info{Major:"1", Minor:"11", GitVersion:"v1.11.2", GitCommit:"bb9ffb1654d4a729bb4cec18ff088eacc153c239", GitTreeState:"clean", BuildDate:"2018-08-07T23:17:28Z", GoVersion:"go1.10.3", Compiler:"gc", Platform:"linux/amd64"}
Server Version: version.Info{Major:"1", Minor:"9", GitVersion:"v1.9.6", GitCommit:"9f8ebd171479bec0ada837d7ee641dec2f8c6dd1", GitTreeState:"clean", BuildDate:"2018-03-21T15:13:31Z", GoVersion:"go1.9.3", Compiler:"gc", Platform:"linux/amd64"}

logs from the pod:

ver 0.0.0.5
Start Slug StatefulSet Autoscaler v.0.0.1
Traceback (most recent call last):
  File "/slug_statefulset_autoscaler/main.py", line 57, in <module>
    list_set = select_statefulset(api, namespace)
  File "/slug_statefulset_autoscaler/tools.py", line 39, in select_statefulset
    for s in pre_set.response['items']:
  File "/usr/local/lib/python2.7/dist-packages/pykube/query.py", line 137, in response
    return self.query_cache["response"]
  File "/usr/local/lib/python2.7/dist-packages/pykube/query.py", line 123, in query_cache
    cache["response"] = self.execute().json()
  File "/usr/local/lib/python2.7/dist-packages/pykube/query.py", line 108, in execute
    r.raise_for_status()
  File "/usr/local/lib/python2.7/dist-packages/requests/models.py", line 909, in raise_for_status
    raise HTTPError(http_error_msg, response=self)
requests.exceptions.HTTPError: 403 Client Error: Forbidden for url: https://kubernetes:443/apis/apps/v1beta1/namespaces/default/statefulsets

last Event:

warning
Back-off restarting failed container
kubelet ip-xxx-xx-xx-x.us-west-2.compute.internal
spec.containers{autoscaler-dev}
7
2018-08-30T11:33 UTC
2018-08-30T11:34 UTC

Have you created the ServiceAccount?

403 Client Error: Forbidden for url: https://kubernetes:443/apis/apps/v1beta1/namespaces/default/statefulsets

Source: https://raw.githubusercontent.com/Tedezed/slug-containers/master/statefulset_autoscaler/kube/slug-autoscaler-rc.yaml

while i'm trying to create that ServiceAccount, i'm eting this issue.
and i'm creating this from your given url.

If you are still interested, try the new version, solve some problems.: https://gist.github.com/Tedezed/29b2efe5aab0beb1809d5fbb82745b47

Image: tedezed/slug-statefulset-autoscaler:2.0

Source: https://github.com/Tedezed/slug-containers/blob/master/statefulset_autoscaler/docker/slug_statefulset_autoscaler/main.py#L33

You can modify the path of SA whith: https://github.com/kelproject/pykube/blob/master/pykube/config.py#L21

Service account does not have sufficient privileges?