# Discourse on k8s on a private network

**URL:** https://meta.discourse.org/t/discourse-on-k8s-on-a-private-network/153243
**Category:** Development
**Created:** [May 29, 2020, 3:13pm UTC](https://meta.discourse.org/t/discourse-on-k8s-on-a-private-network/153243 "2020-05-29T15:13:36Z")
**Posts on this page:** 16
**Page:** 1

<div class="post-metadata">

### Author: ![Divyaanand\_Sinha](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/divyaanand_sinha/32/182302_2.png) [@Divyaanand\_Sinha](https://meta.discourse.org/u/Divyaanand_Sinha)
#### Post date: [May 29, 2020, 3:13pm UTC](https://meta.discourse.org/t/discourse-on-k8s-on-a-private-network/153243/1 "2020-05-29T15:13:37Z")

</div>

I am trying to setup discourse for my organisation on k8s. However there are few issues I am facing.  
When I try to deploy the bootstrapped image on kubernetes it tries to do stuff like  
`git pull pups` and `git pull discourse` which doesnt work since I am on a private network without any access to the internet and as a result the container doesn’t start up. Is there anyway I can skip those parts, so that I can deploy?

---

<div class="post-metadata">

### Author: ![Falco](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/falco/32/179432_2.png) [@Falco](https://meta.discourse.org/u/Falco)
#### Post date: [May 29, 2020, 3:19pm UTC](https://meta.discourse.org/t/discourse-on-k8s-on-a-private-network/153243/2 "2020-05-29T15:19:00Z")

</div>

> [@Divyaanand\_Sinha](#):
>
> When I try to deploy the bootstrapped image on kubernetes it tries to do stuff like  
> `git pull pups` and `git pull discourse` which doesnt work

Are you sure you are deploying an already bootstrapped image? Sounds like you pushed the wrong image to your registry.

---

<div class="post-metadata">

### Author: ![Divyaanand\_Sinha](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/divyaanand_sinha/32/182302_2.png) [@Divyaanand\_Sinha](https://meta.discourse.org/u/Divyaanand_Sinha)
#### Post date: [May 29, 2020, 3:25pm UTC](https://meta.discourse.org/t/discourse-on-k8s-on-a-private-network/153243/3 "2020-05-29T15:25:00Z")

</div>

Oh is it, I am using the image created by `./launcher bootstrap app`

So you are saying that the final bootstrapped image shouldn’t be having any such dependencies?

---

<div class="post-metadata">

### Author: ![Falco](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/falco/32/179432_2.png) [@Falco](https://meta.discourse.org/u/Falco)
#### Post date: [May 29, 2020, 4:05pm UTC](https://meta.discourse.org/t/discourse-on-k8s-on-a-private-network/153243/4 "2020-05-29T16:05:57Z")

</div>

> [@Divyaanand\_Sinha](#):
>
> So you are saying that the final bootstrapped image shouldn’t be having any such dependencies?

No it won’t. After bootstrapping, there will be a `local_discourse/app` image. That is the one that you need to push to the registry and use elsewhere.

---

<div class="post-metadata">

### Author: ![Divyaanand\_Sinha](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/divyaanand_sinha/32/182302_2.png) [@Divyaanand\_Sinha](https://meta.discourse.org/u/Divyaanand_Sinha)
#### Post date: [May 29, 2020, 6:40pm UTC](https://meta.discourse.org/t/discourse-on-k8s-on-a-private-network/153243/5 "2020-05-29T18:40:03Z")

</div>

One final doubt, so it seems i was pushing the wrong image, my bad. So after i push the actual image I can change the env variables during k8s deployment right? Like DISCOURSE\_DB\_HOST etc? Because I have a separate postgres cluster and redis cluster!

---

<div class="post-metadata">

### Author: ![Falco](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/falco/32/179432_2.png) [@Falco](https://meta.discourse.org/u/Falco)
#### Post date: [May 29, 2020, 6:49pm UTC](https://meta.discourse.org/t/discourse-on-k8s-on-a-private-network/153243/6 "2020-05-29T18:49:47Z")

</div>

> [@Divyaanand\_Sinha](#):
>
> One final doubt, so it seems i was pushing the wrong image, my bad.

Been there, done that. No worries, that is a very common mistake. That is why I asked 😛

> [@Divyaanand\_Sinha](#):
>
> So after i push the actual image I can change the env variables during k8s deployment right? Like DISCOURSE\_DB\_HOST etc? Because I have a separate postgres cluster and redis cluster!

Well, it’s complicated.

While you can easily overwrite those, just add the necessary ENV variable to the container run, during bootstrap we run migrations. If you try to point the image to a different database after bootstrapped the database schema will be completely wrong. Doing this would put you well into the #unsupported-install territory.

---

<div class="post-metadata">

### Author: ![Divyaanand\_Sinha](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/divyaanand_sinha/32/182302_2.png) [@Divyaanand\_Sinha](https://meta.discourse.org/u/Divyaanand_Sinha)
#### Post date: [May 29, 2020, 7:01pm UTC](https://meta.discourse.org/t/discourse-on-k8s-on-a-private-network/153243/7 "2020-05-29T19:01:58Z")

</div>

So i already have an instance of discourse running but thats on bare metal, i want to move it to k8s, and connect to the same db the bare metal one was using.

---

<div class="post-metadata">

### Author: ![Divyaanand\_Sinha](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/divyaanand_sinha/32/182302_2.png) [@Divyaanand\_Sinha](https://meta.discourse.org/u/Divyaanand_Sinha)
#### Post date: [May 29, 2020, 7:03pm UTC](https://meta.discourse.org/t/discourse-on-k8s-on-a-private-network/153243/8 "2020-05-29T19:03:58Z")

</div>

Or if possible can I do the bootstrap again with the DISCOURSE\_DB\_HOST and DISCOURSE\_DB\_NAME pointing to the same db the bare metal one is using?

---

<div class="post-metadata">

### Author: ![Falco](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/falco/32/179432_2.png) [@Falco](https://meta.discourse.org/u/Falco)
#### Post date: [May 29, 2020, 7:19pm UTC](https://meta.discourse.org/t/discourse-on-k8s-on-a-private-network/153243/9 "2020-05-29T19:19:42Z")

</div>

That should work!

You may want to stop the current Discourse container that is connected to the DB while doing that, because migrations may make it behave in a broken way.

---

<div class="post-metadata">

### Author: ![Divyaanand\_Sinha](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/divyaanand_sinha/32/182302_2.png) [@Divyaanand\_Sinha](https://meta.discourse.org/u/Divyaanand_Sinha)
#### Post date: [June 3, 2020, 2:30pm UTC](https://meta.discourse.org/t/discourse-on-k8s-on-a-private-network/153243/10 "2020-06-03T14:30:28Z")

</div>

If I create a fresh new empty db and bootstrap using that, then is it possible for me to migrate the data from the UI instead (using the UI of the old discourse instance and the new discourse instance) like /admin/backups? I want to avoid corrupting the old DB , its being used by a lot of users.

---

<div class="post-metadata">

### Author: ![pfaffman](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/pfaffman/32/120154_2.png) [@pfaffman](https://meta.discourse.org/u/pfaffman)
#### Post date: [June 3, 2020, 3:24pm UTC](https://meta.discourse.org/t/discourse-on-k8s-on-a-private-network/153243/11 "2020-06-03T15:24:29Z")

</div>

You can’t migrate from the ux.

See [Introducing Post Deployment Migration](https://meta.discourse.org/t/introducing-post-deployment-migration/98974). This allows you to migrate the database such that it works for both the old and new container, then do final migrations after you deploy.

---

<div class="post-metadata">

### Author: ![Divyaanand\_Sinha](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/divyaanand_sinha/32/182302_2.png) [@Divyaanand\_Sinha](https://meta.discourse.org/u/Divyaanand_Sinha)
#### Post date: [June 8, 2020, 9:40am UTC](https://meta.discourse.org/t/discourse-on-k8s-on-a-private-network/153243/12 "2020-06-08T09:40:30Z")

</div>

Well, i tried what you said (pushed the bootstrapped image) seems like I’m still getting the same error.

```
fatal: unable to access 'https://github.com/discourse/pups.git/': Failed to connect to github.com port 443: Connection timed out

```

I am on a private network so cannot access [github.com](http://github.com)

@pfaffman @Falco is this expected? This i am running on k8s

---

<div class="post-metadata">

### Author: ![Falco](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/falco/32/179432_2.png) [@Falco](https://meta.discourse.org/u/Falco)
#### Post date: [June 8, 2020, 4:58pm UTC](https://meta.discourse.org/t/discourse-on-k8s-on-a-private-network/153243/13 "2020-06-08T16:58:55Z")

</div>

That means you pushed the wrong image, again.

---

<div class="post-metadata">

### Author: ![csmu](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/csmu/32/124581_2.png) [@csmu](https://meta.discourse.org/u/csmu)
#### Post date: [June 8, 2020, 5:08pm UTC](https://meta.discourse.org/t/discourse-on-k8s-on-a-private-network/153243/14 "2020-06-08T17:08:55Z")

</div>

> [@Divyaanand\_Sinha](#):
>
> `git pull pups` and `git pull discourse`

I’d change the internal /etc/hosts file to mimic the resources you want … then add in what is required.

Even easier … put in a modem/router with a 4g / sim connection. make the network recognise that device as the default router for your internal network … connect … do the work … disconnect.

It’s pretty simple.

Cheers

Keith John Hutchison - Ceiteach Seán Mac Úistin  
Bringing Data to Life Pty. Ltd. [(BD2L)](https://bringing-data-to-life.com.au/)

---

<div class="post-metadata">

### Author: ![Divyaanand\_Sinha](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/divyaanand_sinha/32/182302_2.png) [@Divyaanand\_Sinha](https://meta.discourse.org/u/Divyaanand_Sinha)
#### Post date: [June 8, 2020, 5:22pm UTC](https://meta.discourse.org/t/discourse-on-k8s-on-a-private-network/153243/15 "2020-06-08T17:22:36Z")

</div>

this time it seems i’m pretty sure 😅 Is there any possibility that something is erroring out during  
`./launcher bootstrap app`

Moreover I even tried using the current discourse image which is running on bare metal and hosting our current discourse website, and used that on k8s , and that too errors out with the same error as above.

---

<div class="post-metadata">

### Author: ![Divyaanand\_Sinha](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/divyaanand_sinha/32/182302_2.png) [@Divyaanand\_Sinha](https://meta.discourse.org/u/Divyaanand_Sinha)
#### Post date: [June 8, 2020, 5:39pm UTC](https://meta.discourse.org/t/discourse-on-k8s-on-a-private-network/153243/16 "2020-06-08T17:39:22Z")

</div>

Even on my local machine when i do

```
docker run local_discourse/app

```

without internet i seem to get the above error
