# How do I import traefik CRD for kubernetes into a golang project?

**URL:** <https://community.traefik.io/t/how-do-i-import-traefik-crd-for-kubernetes-into-a-golang-project/15340>\
**Category:** Traefik v2\
**Tags:** kubernetes-crd\
**Created:** [August 4, 2022, 7:04pm UTC](https://community.traefik.io/t/how-do-i-import-traefik-crd-for-kubernetes-into-a-golang-project/15340 "2022-08-04T19:04:39Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![skuppa](https://sea2.discourse-cdn.com/flex020/user_avatar/community.traefik.io/skuppa/32/5702_2.png) [@skuppa](https://community.traefik.io/u/skuppa)\
**Post date:** [August 4, 2022, 7:04pm UTC](https://community.traefik.io/t/how-do-i-import-traefik-crd-for-kubernetes-into-a-golang-project/15340/1 "2022-08-04T19:04:39Z")

</div>

I have a golang project to create kubernetes resources. I also need to create traefik resources, the traefik CRD available here [traefik/pkg/provider/kubernetes/crd at v2.2.11 · traefik/traefik · GitHub](https://github.com/traefik/traefik/tree/v2.2.11/pkg/provider/kubernetes/crd) but I am looking for a help, how do I add them into my project?

Thanks,  
-Kuppa

---

<div class="post-metadata">

**Author:** ![skuppa](https://sea2.discourse-cdn.com/flex020/user_avatar/community.traefik.io/skuppa/32/5702_2.png) [@skuppa](https://community.traefik.io/u/skuppa)\
**Post date:** [August 5, 2022, 3:17pm UTC](https://community.traefik.io/t/how-do-i-import-traefik-crd-for-kubernetes-into-a-golang-project/15340/2 "2022-08-05T15:17:12Z")

</div>

I am able to add the CRD by adding the traefik project as a dependent project `github.com/traefik/traefik/v2` and I also need to add additional replace module

```auto
// Docker v19.03.6
replace github.com/docker/docker => github.com/docker/engine v1.4.2-0.20200204220554-5f6d6f3f2203

// Containous forks
replace (
	github.com/abbot/go-http-auth => github.com/containous/go-http-auth v0.4.1-0.20200324110947-a37a7636d23e
	github.com/go-check/check => github.com/containous/check v0.0.0-20170915194414-ca0bf163426a
	github.com/gorilla/mux => github.com/containous/mux v0.0.0-20181024131434-c33f32e26898
	github.com/mailgun/minheap => github.com/containous/minheap v0.0.0-20190809180810-6e71eb837595
	github.com/mailgun/multibuf => github.com/containous/multibuf v0.0.0-20190809014333-8b6c9a7e6bba
)

```

Is this correct way? or Do we have a separate project for CRD only?

Added the CRD into schema so yaml file can be parsed.

```auto
	// Add traefik schema
	err2 := v1alpha1.AddToScheme(scheme.Scheme)
	if err2 != nil {
		logger.Errorw("Adding traefik schema failed", err2)
	}
	decode := scheme.Codecs.UniversalDeserializer().Decode

```

Thanks.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex020/uploads/containo/original/2X/b/bd81ebdb578656e76e56ff3cc3eed021d3ba132d.png) [@system](https://community.traefik.io/u/system)\
**Post date:** [August 8, 2022, 3:17pm UTC](https://community.traefik.io/t/how-do-i-import-traefik-crd-for-kubernetes-into-a-golang-project/15340/3 "2022-08-08T15:17:18Z")

</div>

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.
