-
Notifications
You must be signed in to change notification settings - Fork 299
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
HorizontalPodAutoscaler Example #27
Conversation
Trying to solve next error during build procedure: "14:3 error wrong indentation: expected 4 but found 2 (indentation)"
Second attempt to fix wrong indentation error.
Fixing wrong indentation errors
apiVersion: autoscaling/v2beta2 | ||
kind: HorizontalPodAutoscaler | ||
metadata: | ||
name: nginx-cpu-ram-autoscale |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please follow naming conventions of other resources in this repo
HorizontalPodAutoscaler/nginx.yaml
Outdated
kind: Deployment | ||
metadata: | ||
name: nginx-cpu-autoscale | ||
namespace: default |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
namespace is not needed
HorizontalPodAutoscaler/README.md
Outdated
For deleting cluster, use next: | ||
> `kubectl delete deployment %deployment-name%` | ||
|
||
To create the Deployment with multiple autoscale metrics, run: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It may be a good idea to move this to the top of the doc, under the first apply. When I first followed this document, I didn't really know why I wasn't seeing any hpas, or what I was supposed to do about it.
HorizontalPodAutoscaler/README.md
Outdated
> `kubectl get hpa` | ||
|
||
To view an HPA's configuration and statistics, use the following command: | ||
> `kubectl describe hpa %hpa-name%` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it might be better to put the name used in this specific example; users will want an unambiguous example to follow/copy
HorizontalPodAutoscaler/README.md
Outdated
@@ -0,0 +1,26 @@ | |||
See: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
move refs to the end. this doc should be self-standing, with further reading at the end.
@ianmiell, thanks for your remarks! Fixed them and doublechecked. Should be better, please take a look. |
|
||
To create an HPA object that only targets average CPU utilization, use the following command: | ||
|
||
> `kubectl autoscale deployment horizontal-pod-autoscaler-cpu-based --cpu-percent=50 --min=1 --max=10` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why not 'kubectl apply -f hpa-multi.yaml'?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To demonstrate another way to create a HPA object - manually by kubectl autoscale
command.
Creating HPA object by manifest ('kubectl apply -f hpa-multi.yaml') used a bit later, after removing previously created HPA object:
kubectl delete hpa horizontal-pod-autoscaler-cpu-based
If kubectl autoscale
unnecessary - I'll remove all related commands.
|
||
To view an HPA's configuration and statistics, use the following command: | ||
|
||
> `kubectl describe hpa horizontal-pod-autoscaler-cpu-based` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should be 'horizontal-pod-autoscaler-multiple-metrics'
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
or delete this, as the right command is lower down
@@ -0,0 +1,51 @@ | |||
To create the Deployment, apply the nginx.yaml manifest: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tried this out, but the hpa doesn't fully work because this requires the metrics server to be there too. On docker-desktop I followed this: https://github.com/kubernetes-sigs/metrics-server#deployment but ran into other problems where the pod metrics are not available. Is this something you've solved, and can you supply those steps too?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry for delay - needed some time for checks and troubleshooting. I created 3 nodes of Kubernetes on DigitalOcean, copied components.yaml from https://github.com/kubernetes-sigs/metrics-server and added next strings to in args section:
- --kubelet-insecure-tls
- --kubelet-preferred-address-types=InternalIP
I agree - this is not secure and not good for production deployments. During troubleshooting of this issue I found that now using "kubelet-insecure-tls" in Kubernetes on DigitalOcean is not needed anymore - digitalocean/DOKS#2
But I still cannot make HPA work correctly without "--kubelet-insecure-tls", it works only with both options.
I'll test on a new cluster on DO and on a local server and add needed changes to my examples.
Just added one independently of this PR (forgot about it!) Happy to revive if there's something wrong with the one on master. |
Greetings!
This PR covers #19, please check it.
Thanks!
Regards