Skip to content

Instantly share code, notes, and snippets.

@sbuss
Last active August 29, 2015 14:21
Show Gist options
  • Select an option

  • Save sbuss/4aefceae478122c565e1 to your computer and use it in GitHub Desktop.

Select an option

Save sbuss/4aefceae478122c565e1 to your computer and use it in GitHub Desktop.
Deis self-signed cert cloud-config

Problem

You have a private docker registry that is secured with self-signed cert and you want to do deis pull https://docker-registry.example.com/myapp. Deis won't be able to pull this image because it doesn't trust your self-signed cert.

Solution

To get the CoreOS nodes in a Deis cluster to trust a self-signed cert, you have to customize the deis/contrib/coreos/user-data file before provisioning the cluster. You need to add the following files, shown here in patch format:

--- a/contrib/coreos/user-data.example
+++ b/contrib/coreos/user-data.example
@@ -95,6 +95,17 @@ coreos:
       ExecStart=/bin/bash -c "lsmod | grep overlay || modprobe overlay"
   - name: fleet.service
     command: start
+  - name: updatecertificates.service
+    command: start
+    content: |
+      [Unit]
+      Description=Update the certificates w/ self-signed root CAs
+      Before=etcd.service
+
+      [Service]
+      ExecStart=/usr/sbin/update-ca-certificates
+      RemainAfterExit=yes
+      Type=oneshot
 write_files:
   - path: /etc/deis-release
     content: |
@@ -193,3 +204,41 @@ write_files:
       [Service]
       ExecStart=
       ExecStart=/opt/bin/fleetd-0.9.2
+  - path: /etc/ssl/certs/counsyl-root-ca.pem
+    owner: root
+    permissions: '0644'
+    content: |
+      -----BEGIN CERTIFICATE-----
+      YOUR CERT HERE
+      -----END CERTIFICATE-----

That first addition is under coreos.units, and the latter is just in write_files.

@sbuss

sbuss commented Jun 29, 2015

Copy link
Copy Markdown
Author

Turns out this won't work because the cert has to be passed into the controller container. This only allows the host CoreOS machines to talk to the registry.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment