Skip to content
This documentation applies to Codacy Self-hosted v1.0.1

For the latest updates and improvements, see the latest Cloud documentation instead.

Kubernetes cheatsheet

How to install a custom Codacy version

Install

sudo git clone git://github.com/codacy/chart -b <YOUR-BRANCH>
helm dep build ./chart/codacy
helm upgrade --install codacy ./chart/codacy/ --namespace codacy --atomic --timeout=300 --values ./<YOUR-VALUES-FILE>

Upgrade

(cd chart; sudo git fetch --all --prune --tags; sudo git reset --hard origin/<YOUR-BRANCH>;)
helm dep build ./chart/codacy
helm upgrade --install codacy ./chart/codacy/ --namespace codacy --atomic --timeout=300 --values ./<YOUR-VALUES-FILE>

Edit configmap

kubectl get configmaps

and

kubectl edit configmap <configmap-name>

Restart deployment of daemonset

daemonsets

kubectl get daemonsets

and

kubectl rollout restart daemonset/<daemonset-name>

deployment

kubectl get deployment

and

kubectl rollout restart deployment/<deployment-name>

and

kubectl rollout status deployment/<deployment-name> -w

Read logs

daemonset with multiple containers

kubectl logs daemonset/<daemonset-name> <container-name> -f

service

kubectl get svc

and

kubectl logs -l $(kubectl get svc/<service-name> -o=json | jq ".spec.selector" | jq -r 'to_entries|map("\(.key)=\(.value|tostring)")|.[]' | sed -e 'H;${x;s/\n/,/g;s/^,//;p;};d') -f

Open shell inside container

kubectl exec -it daemonset/<daemonset-name> -c <container-name> sh

or

kubectl exec -it deployment/<deployment-name> sh

MicroK8s

Session Manager SSH

When using AWS Session Manager, to connect to the instance where you installed microk8s, since the CLI is very limited you will benefit from using these aliases:

alias kubectl='sudo microk8s.kubectl -n <namespace-name>'
alias helm='sudo helm'

Share your feedback 📢

Did this page help you?

Thanks for the feedback! Is there anything else you'd like to tell us about this page?

We're sorry to hear that. Please let us know what we can improve:

Alternatively, you can create a more detailed issue on our GitHub repository.

Thanks for helping improve the Codacy documentation.

If you have a question or need help please contact support@codacy.com.

Last modified October 15, 2020