Why can't I successfully follow the Argo CD Getting Started guide? - kubernetes

I have tried so many times uninstalling ArgoCD and reinstalling. I have no idea what I am doing wrong honestly.
I start by installing ArgoCD. I am not interested in anything fancy, so I'm trying the core installation.
kubectl create namespace argocd
kubectl apply -n argocd -f https://raw.githubusercontent.com/argoproj/argo-cd/stable/manifests/core-install.yaml
No errors. The guide says I can use argocd login --core to skip steps 3-5, so I do that:
cis#sd2:~$ argocd login --core
Context 'kubernetes' updated
Looks good as far as I know. Now I try to create their example application:
argocd app create guestbook --repo https://github.com/argoproj/argocd-example-apps.git --path guestbook --dest-server https://kubernetes.default.svc --dest-namespace default
... Nothing. Nothing at all happens. I'm never prompted for another command as long as I don't interrupt the process by pressing control+c. Am I vastly misunderstanding the getting started guide? I am happy to provide any necessary information about my cluster, I just have no idea what information would even be relevant.
This is the guide I am trying to follow: https://argo-cd.readthedocs.io/en/stable/getting_started/

Related

Command to force new deployment in helm?

I use gitlab + kubernetes.
I use this command:
helm secrets -d vault upgrade --install --atomic --namespace NAMESPACE --values VALUES.yml --set image.tag="WHATEVER" DEPLOYMENT_NAME FILE_TO_THIS_DEPLOYMENT
the moment the CI pipeline fails i cannot restart it again, because of some Kubernetes/Helm errors:
another operation (install/upgrade/rollback) is in progress
I know that i can just fix this inside kubernetes and then i can rerun, but this is just a shitty experience for people who dont know that much about Kubernetes/Helm.
Is there a one-shot command which is just really deploying a new version and if the old version was somehow in a failing state, delete/fix it beforehand?
I really just want to execute the same commands again and again and just expect it to work without manually fixing kubernetes state everytime anything happens.

ArgoCD: How restart multiple Apps at once

My Database was down today and multiple applications in my cluster lost the connection with the database, but the Pod was Healthy (I know, I should have better Health Checks, but I don't). So, when the database was back online, the applications weren't able to connect again. So, I would like to restart all my Deployments. They share a label and are in the same Kubernetes namespace. We use ArgoCD to manage the applications.
In ArgoCD, I know I can restart all Deployments in one ArgoCD Application by typing this command:
argocd app actions run my-app restart --kind Deployment --all
https://github.com/argoproj/argo-cd/blob/master/docs/user-guide/commands/argocd_app_actions_run.md
But I do not know how to restart the Deployment of multiple independent applications in ArgoCD. I tried, but none of these work:
argocd app actions run my-app1 my-app2 restart --kind Deployment --all
argocd app actions run -l mylabel=value restart --kind Deployment --all
I wonder how can I restart multiple applications in ArgoCD in one command?
I would like to use same syntax of the sync command (https://github.com/argoproj/argo-cd/blob/master/docs/user-guide/commands/argocd_app_sync.md):
argocd app sync [APPNAME... | -l selector] [flags]
I tried to use sync, but it does not restart Deployments, unless I make some change in the Deployment itself (or if I use a configMap Generator, which is not my case).
Thank you in advance.
EDIT: I created a shell script for my needs:
for i in $(argocd app list -l yourgroup=your.label --output name); do
argocd app actions run $i restart --kind Deployment --all;
done
It will fail for those apps which does not have a Deployment, but, for me, restarted everything I wanted.

Permission denied using kubectl but able to run helm

I am facing permission denied errors when using kubectl for all commands, be get pods or apply, but I am able to use helm and login with k9s to perform destructive actions. I am using the same context for all of these actions.
kubectl get nodes
# error: You must be logged in to the server (Unauthorized)
kubectl apply -f some-manifest.yaml
# error: You must be logged in to the server (the server has asked for the client to provide credentials)
Does anyone have a hint as to why this is happening or what to look further into? I am using a managed k8s on Vultr, a smaller cloud provider.
Don't know what specifically the issue was but I rebuilt my .kube/config file slowly with all my contexts and it ended up working again.
Very strange though that helm worked and kubectl didn't though...
I am pretty sure that this is a "kubernetes context" problem
Check the solution here: helm and kubectl context mismatch
Solution for k9s can be found here: https://k9scli.io/topics/commands/

How to install kubernetes / ingress-nginx using kubectl ? (not helm)

I would like to use kubernetes/ingress-nginx using kubectl apply -f when I deploy in AKS (Azure), but I cannot figure out how.
I know that I can do kubectl apply -f https://github.com/kubernetes/ingress-nginx/blob/master/deploy/static/provider/cloud/deploy.yaml
but the problem is that this provides a very non-configurable version with a lot of items on it.
Any idea? I don't want to start to edit and customize deploy.yaml in the current form as it's super ugly. It is an option but anyone has any better idea?
I know that I can use help, and that's a current production version, but for some reason, I need to try to move to kubectl apply -f
Thanks in advance.
Have a look at Kustomize
https://kubernetes.io/blog/2018/05/29/introducing-kustomize-template-free-configuration-customization-for-kubernetes/
https://github.com/kubernetes-sigs/kustomize/tree/master/examples/helloWorld
it was made exactly for your use case.
I would suggest using helm3 for installing packages (which allows configuration with maintability as main aim). You can see helm package for nginx-ingress (https://github.com/helm/charts/tree/master/stable/nginx-ingress) and configure the parameters also.
Note there are multiple version of helm for nginx-ingress. You can choose which works for you the best (one if community maintained and other is nginx maintained).
Edit: - helm template can be used to spit out yaml file which can be used with kubectl to apply directly. Moreover helm3 can directly work with kubectl without any server side component.

Spinnaker - Error during 'Create LoadBalancer'

I installed Spinnaker on my test cluster using Helm charts. When I tried to create a LoadBalancer, I noticed the 'namespace' dropdown was blank in the dialog box. When I just tried to create the loadbalancer, I see the error ' unregistered namespace'. I have attached screenshots for your reference. I would appreciate any help in resolving this! Thanks.
I was having the exact same issue, after some digging around, found that the cloudDriver was throwing bunch of error for access denied while accessing the kubernetes API's.
To see running pods:
kubectl get pods
To see logs of the cloudDriver pods - kubectl logs YOUR_CLOUD_DRIVER_POD_NAME
I was reading online and found that spinnaker needs RBAC access control setup. Then lead me to this answer, which solved it for me temporarily until I get my self familiar with spinnaker.
Below command as suggested in above link, helped me and I was able to run spinnaker in minikube in my local machine.
kubectl create clusterrolebinding spinnaker-default-crbinding --clusterrole cluster-admin --serviceaccount=default:default
Just to note that you will need to change --serviceaccount accordingly. I had to change it.