Templates in Kubernetes

How can I access and access templates when I have deployed coder on Kubernetes. When directly deploying on the machine, I can easily run the commands as provided for creating templates and workspaces. But how to do this for coder on Kubernetes
54 Replies
Atif
Atif2y ago
I have no experience with a kubernetes installation but may be you can try this, Hi, After installation you should be able to access the coder webUI on your ACCESS_URL and create the first user then login to coder using your ACCESS_URL
coder login ACCESS_URL
coder login ACCESS_URL
After that it will be same I guess.
Chinz
ChinzOP2y ago
Ah. Ok I am able to login But another problem occured.. When I am creating a template, it says this Error: Error when reading or editing GCE default service account: googleapi: Error 403: Request had insufficient authentication scope coder templates create I have given access to this but still this error is occuring
Phorcys
Phorcys2y ago
you have given access but you didn't give it enough permissions it seems
Chinz
ChinzOP2y ago
So how can I get required permissions?
Phorcys
Phorcys2y ago
i thought you were using kubernetes, why the gce ? I'm unsure, it should prompt you for which permissions you want to give it ?
Chinz
ChinzOP2y ago
So when I started with the steps, I just jumped here and there as I dont have idea about K8s or docker. So I just popped up an Gcloud CE and started with configuring Kubernetes with it I had no idea if its done like this or what
Phorcys
Phorcys2y ago
it's not basically when you upload the template, the kubernetes instance will be accessed from the machine that coder is running on so it needs to be accessible from that machine
Chinz
ChinzOP2y ago
Oh..
Phorcys
Phorcys2y ago
provider "kubernetes" {
host = "https://cluster_endpoint:port"
}
provider "kubernetes" {
host = "https://cluster_endpoint:port"
}
Chinz
ChinzOP2y ago
I logged in on coder with the same CE on which I configured all this helm and kubectl So where this piece of text has to be put?
Phorcys
Phorcys2y ago
in your template but I think you should show me your template first remove any secrets
Chinz
ChinzOP2y ago
I didnt did much just created using template init and choosed Linux on GCP and then coder templates create(where I got this error)
Phorcys
Phorcys2y ago
with that template every workspace will be a GCP instance
Chinz
ChinzOP2y ago
So does it mean that all the workspaces I create using that template (GCP-linux), It will be a seperate GCP VM?
Phorcys
Phorcys2y ago
yes
Chinz
ChinzOP2y ago
ah.. So whats the correct way? Starting from scrach
Phorcys
Phorcys2y ago
choose the kubernetes/docker template then fill in the required info in the template for coder to be able to connect to your endpoint
Chinz
ChinzOP2y ago
Okay.. And then what about the auth error?
Phorcys
Phorcys2y ago
that won't happen since it won't have to access to gcp
Chinz
ChinzOP2y ago
let me try it rn says A template already exists named "kubernetes"! Is this okay? as I havent done this
Phorcys
Phorcys2y ago
maybe you already tried to do it ? can you show me
Chinz
ChinzOP2y ago
ig it was because of the value.yaml in helm
Chinz
ChinzOP2y ago
No description
Phorcys
Phorcys2y ago
i'm really not sure lol
Chinz
ChinzOP2y ago
do you have any idea that how to set this coder.serviceAccount.worksp... true as it says in comment
Phorcys
Phorcys2y ago
uuuuh no not really I've never used k8s at all I guess it's time to learn it I doubt this would be related to your issue though it wouldn't make sense what command are you running ?
Chinz
ChinzOP2y ago
also, if I just assume that it has a template ready for me, still it is not working for creating a workspace
Chinz
ChinzOP2y ago
No description
Phorcys
Phorcys2y ago
could you show me the templates tab from your coder deployment ?
Chinz
ChinzOP2y ago
that coder tempaltes init and selection kubernetes
Phorcys
Phorcys2y ago
here
No description
Chinz
ChinzOP2y ago
No description
Phorcys
Phorcys2y ago
yeah makes sense
Chinz
ChinzOP2y ago
and if I click create workspaces then it shows same
Phorcys
Phorcys2y ago
it tries to create the template on your server but it already exists
Chinz
ChinzOP2y ago
No description
Phorcys
Phorcys2y ago
you should delete that template
Chinz
ChinzOP2y ago
how to delete a template?
Phorcys
Phorcys2y ago
click on it's name and click settings then scroll down and delete it although it seems you can't access that page try to visit /templates/kubernetes/settings
Chinz
ChinzOP2y ago
ok cool let me try ok its deleted now I am going to init it
Chinz
ChinzOP2y ago
No description
Chinz
ChinzOP2y ago
see this what should I choose
Phorcys
Phorcys2y ago
actually maybe that is the issue yeah brb
Chinz
ChinzOP2y ago
okay
Phorcys
Phorcys2y ago
aight so is your coder host running a k8s pod I'd assume yes yeah set to false
Chinz
ChinzOP2y ago
Ig.. If it was mentioned on K8s documentation so I have done that as said
Phorcys
Phorcys2y ago
I'm totally unsure lol maybe @kyle can help, dunno who to ping
Chinz
ChinzOP2y ago
okay btw whats coder host exactly?
Phorcys
Phorcys2y ago
the env coder is running in so it can be a vm, a docker container, etc
Chinz
ChinzOP2y ago
so I have that GCP VM from I am executing commands to control cluster and I have logged into coder other I have a K8s cluster from I guess where my coder is running should I give a try to setting false? also, I dont have a kube/config file on my VM so ig setting false will be the only option I guess...
Codercord
Codercord2y ago
Marked the thread as resolved.
Chinz
ChinzOP2y ago
Thanks @Phorcys its created
Phorcys
Phorcys2y ago
well yeah, but does the template actually work ?
Chinz
ChinzOP2y ago
I created a workspace with it. now trying to get vscode web ide on workspace Also, I had a doubt about stopping and starting coder on k8s? How can I stop the code server without forcefully shutting down whole VM and how to restart it. So that when I'll not be using it, I'll stop it
Want results from more Discord servers?
Add your server