Hi Everyone, I am starting a new project where I b...
# general
q
Hi Everyone, I am starting a new project where I basically need to deploy the “equivalent” of a bunch of REST (micro-) services, one or two databases an ingress-controller and kafka onto my k3s kubernetes cluster. Because I can choose to use the technology I want, I have decided to explore what it means to go “serverless”. Additionally, I want to use Pulumi as much as possible. I am a developer by trade, but had an active “devops”-role for over 5 years, with 24/7 on-call and all the shiny stuff. I basically want to accomplish what is shown in this tutorial https://www.pulumi.com/serverless/. Before I start, is this currently possible using Pulumi and a local k3s cluster?
a
Serverless is a bit of a misnomer, since there is still some infrastructure needed to run your code, but it's invisible to you. AWS, Azure and GCP have their own managed solutions to achieve that. For a local Kubernetes cluster you do have to worry and manage it yourself. There are some solutions to have the same serverless computational capabilities on Kubernetes, but I don't think any of them are official, thus no Pulumi support.
q
Thank you @ambitious-father-68746, by “exploring serverless” I want to learn and understand for myself in how far I can shield or abstract the infrastructure away from my role as a developer. It is clear, that there is always infrastructure involved and in the end, everything runs on bare-metal. Due to our clients-nature, it is not possible to use any public clouds. I have to stay in a local environment and was hoping to find and use the same level of abstraction.
a
I've been away from Kubernetes for a while now, but I remember that Kubeless being regarded as the go-to serverless framework for Kubernetes.
If Pulumi handles Kubernetes objects OK, then it should be possible to achieve what you want.
q
Thanks for the hint with kubeless, I will do some research on it. But basically, I would write my own abstractions using Pulumi in case I stay with k3s by using the Kubernetes-plugin and so on. Is my understanding correct?
b
I've done a little experiment in wrapping a terraform provider for kind: https://github.com/pawelprazak/pulumi-kind/
just an experiment right now so no packaged published
but I've also used pulumi with regular kind
super simple to use
Copy code
kind create cluster --config kind.config.yaml
with `kind.config.yaml`:
Copy code
kind: Cluster
apiVersion: <http://kind.x-k8s.io/v1alpha4|kind.x-k8s.io/v1alpha4>
nodes:
  - role: control-plane
  - role: worker
  - role: worker
then just point the provider to it:
Copy code
const kindContext = "kind-kind"
const kindProvider = new k8s.Provider(kindContext, {
    context: kindContext
})
and use normally:
Copy code
const ns = new k8s.core.v1.Namespace(
    nsName,
    {
        metadata: {
            name: nsName,
            labels: {
                name: nsName,
                app: appName
            }
        }
    },
    { provider: kindProvider },
)
btw. if there are any ts/js devs here and want to drop a PR or issue in my pulimi-kind repo on how to publish to npm, then it would be appreciated (I'm new to node)