#geodesic - April 2019

S
SweetOps #geodesicover 7 years ago
There is 1 event this week
Pablo Costa
Pablo Costaover 7 years ago(edited)
Hello,

I'm rebuilding some packages of the cloudposse/packages container and getting this error: mktemp: failed to create directory via template ‘../../tmp/tmp.XXXXXXXXXX’: No such file or directory

I could observe that the problem is related to this file included at makefile: "/packages/tasks/Makefile.apk"

...
export APK_TMP_DIR := $(realpath $(shell mktemp -p ../../tmp -d))
...

As I wasn't interested in apk packages I've just erased this file: echo > /packages/tasks/Makefile.apk to not get errors during the build process, but I thing that It worth's be mentioned this problem,
just to check if I doing something wrong



/packages # echo "1.14.0" > /packages/vendor/kubectl/VERSION
/packages # make -C install kubectl
make: Entering directory '/packages/install'
make[1]: Entering directory '/packages/vendor/kubectl'
mktemp: failed to create directory via template ‘../../tmp/tmp.XXXXXXXXXX’: No such file or directory
curl --retry 3 --retry-delay 5 --fail -sSL -o /packages/bin/kubectl https://storage.googleapis.com/kubernetes-release/release/v1.14.0
/bin/linux/amd64/kubectl && chmod +x /packages/bin/kubectl
make[1]: Leaving directory '/packages/vendor/kubectl'
make: Leaving directory '/packages/install'
Erik Osterman (Cloud Posse)
Erik Osterman (Cloud Posse)over 7 years ago
Thanks for reporting
Erik Osterman (Cloud Posse)
Erik Osterman (Cloud Posse)over 7 years ago
@Pablo Costa can you open an issue for that?
Erik Osterman (Cloud Posse)
Erik Osterman (Cloud Posse)over 7 years ago
I'll have @Maxim Mironenko (Cloud Posse) look into it
Erik Osterman (Cloud Posse)
Erik Osterman (Cloud Posse)over 7 years ago(edited)
for now, maybe use an earlier version of cloudposse/packages?
Erik Osterman (Cloud Posse)
Erik Osterman (Cloud Posse)over 7 years ago
(btw, if you're using alpine, then we suggest using apk add instead of the make based installer)
Pablo Costa
Pablo Costaover 7 years ago
Thanks Erik, btw how is the policy for package updates ? For example helm version is at 2.11 (avaliable 2.13) terraform is 0.11.11 (avaliable 0.11.13)
Erik Osterman (Cloud Posse)
Erik Osterman (Cloud Posse)over 7 years ago
oh, open policy!
Erik Osterman (Cloud Posse)
Erik Osterman (Cloud Posse)over 7 years ago
open a PR and we'll approve it usually with in a couple of hours
Erik Osterman (Cloud Posse)
Erik Osterman (Cloud Posse)over 7 years ago
only reason our versions lag is (we or you) didn't submit a PR to update it
Erik Osterman (Cloud Posse)
Erik Osterman (Cloud Posse)over 7 years ago
😃
Erik Osterman (Cloud Posse)
Erik Osterman (Cloud Posse)over 7 years ago
since we can version pin everything, we're very open to keeping things current.
Erik Osterman (Cloud Posse)
Erik Osterman (Cloud Posse)over 7 years ago
Here are the slides from the "Los Angeles Kubernetes Meetup" where we presented on Geodesic.
Erik Osterman (Cloud Posse)
Erik Osterman (Cloud Posse)over 7 years ago
S
SweetOps #geodesicover 7 years ago
Erik Osterman (Cloud Posse)
Erik Osterman (Cloud Posse)over 7 years ago
I'm going to hang out in this zoom for a little bit in case anyone has any questions.
Erik Osterman (Cloud Posse)
Erik Osterman (Cloud Posse)over 7 years ago
(fwiw, we had daylight savings in the US on March 10)
Erik Osterman (Cloud Posse)
Erik Osterman (Cloud Posse)over 7 years ago
I am not sure :-)
Jan
Janover 7 years ago
hey hey
Jan
Janover 7 years ago(edited)
danyone know why kops is still 1.10.* in geodesic?
Jan
Janover 7 years ago
rather than 1.11.0
S
SweetOps #geodesicover 7 years ago
There is 1 event this week
jober
joberover 7 years ago
So if I wanted to get starting trying to use geodesic where is the best place to start. I see lots of information about and references to geodesic and reference architectures, just wonder if there is a certain order to follow. Any info would be helpful, thanks
Josh Larsen
Josh Larsenover 7 years ago(edited)
i've noticed the build-harness has a lot of cloudposse references... is forking this repo also recommended when getting setup with geodesic? it seems to be a dependency and affects commands like readme generation and such.
Erik Osterman (Cloud Posse)
Erik Osterman (Cloud Posse)over 7 years ago
@Josh Larsen yes/no - I think it's a great idea to fork it for your own org's needs
Erik Osterman (Cloud Posse)
Erik Osterman (Cloud Posse)over 7 years ago
that said, there's no easy way to take advantage of your fork in our repos 😃
chrism
chrismover 7 years ago
If you add sops to the geodesic
RUN wget <https://github.com/mozilla/sops/releases/download/3.2.0/sops-3.2.0.linux> -O /usr/bin/sops && chmod +x /usr/bin/sops
and set the env vars

RUN curl <https://keybase.io/user/pgp_keys.asc> | gpg --import 
ENV SOPS_KMS_ARN="arn:aws:kms:xx-xxx-x:xxxx:key/xxx-xxx-xxx-xxx-xxxx"
ENV SOPS_PGP_FP="APGPKEY,ANOTHERPGPKEY,ETC"


You can use sops encryption before pushing files into storage so they're only un-encrypted within the container during use
S
SweetOps #geodesicover 7 years ago
raehik
raehikover 7 years ago
Question I forgot I had yesterday: I know that Geodesic opens a port (range?) for handy kubectl port-forwards. How do I use it, and what version was it released in? (in the last month, or older?)
Erik Osterman (Cloud Posse)
Erik Osterman (Cloud Posse)over 7 years ago(edited)
Yes, that's supported - it's been in the container for years
Erik Osterman (Cloud Posse)
Erik Osterman (Cloud Posse)over 7 years ago
there's an env inside the container that contains the port number
Erik Osterman (Cloud Posse)
Erik Osterman (Cloud Posse)over 7 years ago
Erik Osterman (Cloud Posse)
Erik Osterman (Cloud Posse)over 7 years ago
That said, I think we should rename the port to be more generic
Erik Osterman (Cloud Posse)
Erik Osterman (Cloud Posse)over 7 years ago
so it can be repurposed/overloaded
raehik
raehikover 7 years ago
Thanks, I was looking for $GEODESIC*
Erik Osterman (Cloud Posse)
Erik Osterman (Cloud Posse)over 7 years ago
Here's how we used geodesic with Codefresh to achieve GitOps with terraform on Codefresh
Erik Osterman (Cloud Posse)
Erik Osterman (Cloud Posse)over 7 years ago
Abel Luck
Abel Luckover 7 years ago
how does geodesic handle issues of uid/gid when mounting dirs from the host?
Abel Luck
Abel Luckover 7 years ago
could someone point me to the code where that happens?
Erik Osterman (Cloud Posse)
Erik Osterman (Cloud Posse)over 7 years ago
It does nothing with uid/gid mapping
Jeremy G (Cloud Posse)
Jeremy G (Cloud Posse)over 7 years ago
Geodesic installs a wrapper script to run the container, which launches the container with something like (but not exactly, and with other options) docker run -it --privileged --volume=$HOME=/localhost. The shell inside the Geodesic container is run as root. The permissions mapping is handled by Docker. I use docker-machine on my Mac, so everything Docker runs runs as me and the root user inside the Docker container has the same permissions as I do on the host. Files created on the host from Geodesic are owned by me and files I cannot read cannot be read from inside Geodesic.
Erik Osterman (Cloud Posse)
Erik Osterman (Cloud Posse)over 7 years ago(edited)
I think the behavior is slightly different on linux, where UID/GID within the container are preserved on the host machine, but what @Jeremy G describes is correct on OSX.
Abel Luck
Abel Luckover 7 years ago
ah ok, that explains what i'm seeing
Abel Luck
Abel Luckover 7 years ago
on macos it just works, but on our linux workstations the host mounted files are written with root:root
Erik Osterman (Cloud Posse)
Erik Osterman (Cloud Posse)over 7 years ago
Erik Osterman (Cloud Posse)
Erik Osterman (Cloud Posse)over 7 years ago
I was hoping they supported uid/gid mapping in bind-mount (by now), but it's not supported
Erik Osterman (Cloud Posse)
Erik Osterman (Cloud Posse)over 7 years ago
we could technically drop to a non-privileged user in geodesic, but haven't optimized for that.
S
SweetOps #geodesicover 7 years ago
There are no events this week
Eugene Korekin
Eugene Korekinover 7 years ago
Hello, everyone. I am trying to follow the cold-start procedure described here https://docs.cloudposse.com/reference-architectures/cold-start/ but it seems that it is outdated, right now I have an issues trying to create users, could anybody help me?
Erik Osterman (Cloud Posse)
Erik Osterman (Cloud Posse)over 7 years ago
@Eugene Korekin sorry for the troubles!
Erik Osterman (Cloud Posse)
Erik Osterman (Cloud Posse)over 7 years ago
yes, the cold-start docs are quite out of date and refer to a older implementation.
Erik Osterman (Cloud Posse)
Erik Osterman (Cloud Posse)over 7 years ago
our current process is being kept up to date here: https://github.com/cloudposse/reference-architectures
Erik Osterman (Cloud Posse)
Erik Osterman (Cloud Posse)over 7 years ago
Eugene Korekin
Eugene Korekinover 7 years ago
thanks, Eric! I'll take a look
Eugene Korekin
Eugene Korekinover 7 years ago
@Eric Johnson could you please tell me what would be the best approach if I already created the master aws account in aws orgs? I think I can't remove it
Erik Osterman (Cloud Posse)
Erik Osterman (Cloud Posse)over 7 years ago
@Eugene Korekin :hiding:
Eugene Korekin
Eugene Korekinover 7 years ago
I used the older implementation to create it
Erik Osterman (Cloud Posse)
Erik Osterman (Cloud Posse)over 7 years ago
soooo you have a couple of options.
Erik Osterman (Cloud Posse)
Erik Osterman (Cloud Posse)over 7 years ago
did you create those AWS accounts by hand or using terraform?
Eugene Korekin
Eugene Korekinover 7 years ago(edited)
I used the existing account as the base for the procedure described in the old cold start, the master account referring to the existing account was created in aws orgs in the process
Erik Osterman (Cloud Posse)
Erik Osterman (Cloud Posse)over 7 years ago
ok, so option (1) is to continue going down the path you were. there's nothing wrong with that per say.
Eugene Korekin
Eugene Korekinover 7 years ago
so the master account was created via terraform, but it already has some ec2 instances etc
Erik Osterman (Cloud Posse)
Erik Osterman (Cloud Posse)over 7 years ago
so there's no one way to bring up this infrastructure. the idea is the geodeisc is just a run time environment.
Erik Osterman (Cloud Posse)
Erik Osterman (Cloud Posse)over 7 years ago
what you do inside of it is entirely open-ended.
Eugene Korekin
Eugene Korekinover 7 years ago
I stuck on that path, as the user creation step requires some contents present in ssm and I cannot find how to create this content with the old procedure
Erik Osterman (Cloud Posse)
Erik Osterman (Cloud Posse)over 7 years ago
hrmmm so mostly likely, the user creation stuff will then need to use older versions of the modules that pre-date the SSM dependencies
Erik Osterman (Cloud Posse)
Erik Osterman (Cloud Posse)over 7 years ago
i can't say what version that would be.
Erik Osterman (Cloud Posse)
Erik Osterman (Cloud Posse)over 7 years ago
to start fresh though, would involve the following:
Eugene Korekin
Eugene Korekinover 7 years ago
Erik Osterman (Cloud Posse)
Erik Osterman (Cloud Posse)over 7 years ago
1. password reset on each account
Eugene Korekin
Eugene Korekinover 7 years ago
here is the error I have
Erik Osterman (Cloud Posse)
Erik Osterman (Cloud Posse)over 7 years ago
2. login to each account, accept t&c
Erik Osterman (Cloud Posse)
Erik Osterman (Cloud Posse)over 7 years ago
3. terraform destroy accounts
Erik Osterman (Cloud Posse)
Erik Osterman (Cloud Posse)over 7 years ago
---
Erik Osterman (Cloud Posse)
Erik Osterman (Cloud Posse)over 7 years ago
then you have a clean base
Eugene Korekin
Eugene Korekinover 7 years ago(edited)
is there a way to somehow import existing accounts?
Eugene Korekin
Eugene Korekinover 7 years ago(edited)
they are already in use
Erik Osterman (Cloud Posse)
Erik Osterman (Cloud Posse)over 7 years ago
you can import existing accounts, however @Jeremy G recently went through this with one of our current clients and if every parameter doesn't match 100% it wants to recreate them
Erik Osterman (Cloud Posse)
Erik Osterman (Cloud Posse)over 7 years ago(edited)
(jumping on a ☎️)
Eugene Korekin
Eugene Korekinover 7 years ago(edited)
I see, is there a way to only create a new account (let's say 'testing') and leave the master one as it is (including all the existing users)?
Erik Osterman (Cloud Posse)
Erik Osterman (Cloud Posse)over 7 years ago
yes, you can probabblby do that
Erik Osterman (Cloud Posse)
Erik Osterman (Cloud Posse)over 7 years ago
use accounts_enabled flag to only select testing
Erik Osterman (Cloud Posse)
Erik Osterman (Cloud Posse)over 7 years ago
e.g. get your feet wet with the system
Erik Osterman (Cloud Posse)
Erik Osterman (Cloud Posse)over 7 years ago(edited)
there's a lot of moving pieces, so getting your hands dirty with one account would be a good idea
Eugene Korekin
Eugene Korekinover 7 years ago
so, do I just need to skip 'make root' and start right from 'make children'?
Eugene Korekin
Eugene Korekinover 7 years ago
I've just tried it, and it doesn't seem to work, the make command doesn't provide any output
Jeremy G (Cloud Posse)
Jeremy G (Cloud Posse)over 7 years ago
You need to set up your configs/root.tfvars with all the right configuration (hopefully it's reasonably self-explanatory) including accounts_enabled limited to the accounts you want to create. Then set yourself up with AWS admin credentials in your "root" AWS account and run make root. This creates the children accounts and sets up roles and network CIDRs and so forth and creates a bootstrap user you will use for the rest of the configuration.
Eugene Korekin
Eugene Korekinover 7 years ago
but in won't change anything inside the root account in the process, right?
Jeremy G (Cloud Posse)
Jeremy G (Cloud Posse)over 7 years ago
It will definitely change things inside the root account. The root account is where your users are created and roles for the children account are created and DNS entries for children DNS subdomains are created.
Eugene Korekin
Eugene Korekinover 7 years ago
I don't want to change any of the existing users, won't it be possible to proceed without that?
Eugene Korekin
Eugene Korekinover 7 years ago
in other words, would it be possible to use the existing user entries in the master account and reuse then in the children ones?
Erik Osterman (Cloud Posse)
Erik Osterman (Cloud Posse)over 7 years ago
so our reference architectures don't provide that level of configurability b/c the number of permutations is insurmountable
Erik Osterman (Cloud Posse)
Erik Osterman (Cloud Posse)over 7 years ago
however, all of our terraform modules are compose of other modules
Erik Osterman (Cloud Posse)
Erik Osterman (Cloud Posse)over 7 years ago
you can pick and choose exactly what you want to use
Erik Osterman (Cloud Posse)
Erik Osterman (Cloud Posse)over 7 years ago
Office Hours
Today from 11:30 AM to 12:20 PM at https://zoom.us/j/684901853
Erik Osterman (Cloud Posse)
Erik Osterman (Cloud Posse)over 7 years ago
(PST)
S
SweetOps #geodesicover 7 years ago
There are no events this week
C
Cloud Posseover 7 years ago
Join us for "Office Hours" every Wednesday 11:30AM (PST, GMT-7).

This is an opportunity to ask us questions about INLINECODE_0, get live demos and learn from others using it. Next one is Mar 20, 2019 11:30AM.

👉️ Add it to your calendar

:zoom: https://zoom.us/j/684901853

:slack: #office-hours (our channel)
Josh Larsen
Josh Larsenover 7 years ago
question: let's say my terraform-root-modules is a private repo... how can i get my github keys into geodesic so the terraform init will be able to retrieve the modules?
Erik Osterman (Cloud Posse)
Erik Osterman (Cloud Posse)over 7 years ago
@Josh Larsen you have a few options
Erik Osterman (Cloud Posse)
Erik Osterman (Cloud Posse)over 7 years ago
are you running this under CI/CD or as a human?
Erik Osterman (Cloud Posse)
Erik Osterman (Cloud Posse)over 7 years ago(edited)
then we add the ssh public key as a deploy key to the root modules repo
Josh Larsen
Josh Larsenover 7 years ago
ideally i'd like to do both
Josh Larsen
Josh Larsenover 7 years ago
but let's start with human for now
Josh Larsen
Josh Larsenover 7 years ago
i'm thinking something like cat /localhost/.ssh/id_rsa | ssh-add - would do it, but would just have to do that every time i started the shell. or is there a better way?
Erik Osterman (Cloud Posse)
Erik Osterman (Cloud Posse)over 7 years ago(edited)
are you on a mac or linux?
Erik Osterman (Cloud Posse)
Erik Osterman (Cloud Posse)over 7 years ago
on linux, we mount your ssh agent socket into the container
Erik Osterman (Cloud Posse)
Erik Osterman (Cloud Posse)over 7 years ago
we can't do that on a mac
Erik Osterman (Cloud Posse)
Erik Osterman (Cloud Posse)over 7 years ago
the other option is to store your ssh key in SSM
Josh Larsen
Josh Larsenover 7 years ago
i'm on mac... but i think i get the idea. thanks.
tamsky
tamskyover 7 years ago
I was experimenting today with terragrunt vs vanilla terraform init and wanted to point out a few important differences between these two similar methods:
- terragrunt { source = "<blueprint source>" } and
- terraform init -from-module=<blueprint source>

terragrunt allows the use of:
- override.tf [1] files in the CWD
- "mix-in" files in the CWD (*.tf files that do not match blueprint filenames), useful for adding one-off resources to a blueprint
- "upstage" files in the CWD (*.tf files that do match a blueprint filename), these replace the contents of a blueprint source file of the same name), useful for removing blueprint resources
This is due to the fact that terragrunt init creates a tmp dir, clones the SOURCE to the tmp dir, and then copies/overwrites (aka "upstages") all files in the CWD to the tmp dir (overwriting any duplicates).

Whereas terraform init -from-module= requires that the CWD contains zero files matching *.tf or *.tf.json. This prevents all the above techniques: overrides, mix-ins, and upstage files.

Has anyone thought about how to support/implement the override, mix-in and upstage patterns without the use of terragrunt?

[1] https://www.terraform.io/docs/configuration-0-11/override.html
Mike Pfaffroth
Mike Pfaffrothover 7 years ago
Hi- if I have started the "quick start" with example.io, had an issue and ran make clean (after terraform had created some things), how can I most easily "reset"?
Mike Pfaffroth
Mike Pfaffrothover 7 years ago
I want to run terraform destroy essentially
Mike Pfaffroth
Mike Pfaffrothover 7 years ago
I am getting, for example-
* module.staging.aws_organizations_account.default: 1 error(s) occurred:

* aws_organizations_account.default: Error creating account: AccessDeniedException: You don't have permissions to access this resource.
	status code: 400, request id: 5b93365b-67b0-11e9-808b-3fc6f3a60880
* module.dev.aws_organizations_account.default: 1 error(s) occurred:

* aws_organizations_account.default: Error creating account: AccessDeniedException: You don't have permissions to access this resource.
	status code: 400, request id: 5b9335cd-67b0-11e9-b64d-9b693972455f
* module.prod.aws_organizations_account.default: 1 error(s) occurred:

* aws_organizations_account.default: Error creating account: AccessDeniedException: You don't have permissions to access this resource.
	status code: 400, request id: 5b92998f-67b0-11e9-b23d-dd34fe4bf6c3
* module.audit.aws_organizations_account.default: 1 error(s) occurred:

* aws_organizations_account.default: Error creating account: AccessDeniedException: You don't have permissions to access this resource.
	status code: 400, request id: 5b93362c-67b0-11e9-a70f-ffba4d75ead7
Erik Osterman (Cloud Posse)
Erik Osterman (Cloud Posse)over 7 years ago
@Mike Pfaffroth recommend to start here instead: https://github.com/cloudposse/reference-architectures
Mike Pfaffroth
Mike Pfaffrothover 7 years ago
@Erik Osterman (Cloud Posse) I am running that (I’m in the make root stage)
erik
erikover 7 years ago
Erik Osterman (Cloud Posse)
Erik Osterman (Cloud Posse)over 7 years ago
so terraform destroy will fail when trying to delete the accounts
Erik Osterman (Cloud Posse)
Erik Osterman (Cloud Posse)over 7 years ago(edited)
you can destroy the accounts after jumping through a lot of hoops (password reset, login, accept t&c, etc - for each child account)
Mike Pfaffroth
Mike Pfaffrothover 7 years ago
right- I guess what I was trying to say is- is that process documented anywhere?
Mike Pfaffroth
Mike Pfaffrothover 7 years ago
I know I’m in a bad position, I am trying to find a similar checklist
Erik Osterman (Cloud Posse)
Erik Osterman (Cloud Posse)over 7 years ago(edited)
aha! yes, good question
Erik Osterman (Cloud Posse)
Erik Osterman (Cloud Posse)over 7 years ago
no, we have not documented it. @Jeremy G would it be relatively quick for you to open an issue against the reference-architectures that describes the process you took? It's been a long enough time that I can't recall every step.
Erik Osterman (Cloud Posse)
Erik Osterman (Cloud Posse)over 7 years ago
i just remember doing the password reset on every child account so that I could log in
Erik Osterman (Cloud Posse)
Erik Osterman (Cloud Posse)over 7 years ago
then i think there was some kind of terms & conditions I had to accept (checkbox/click)
Erik Osterman (Cloud Posse)
Erik Osterman (Cloud Posse)over 7 years ago
and after that, I think it's sufficient enough to retry the terraform destroy
Erik Osterman (Cloud Posse)
Erik Osterman (Cloud Posse)over 7 years ago
that said, I don't think it's possible to reuse the same email address on round 2
Erik Osterman (Cloud Posse)
Erik Osterman (Cloud Posse)over 7 years ago(edited)
@oscarsullivan_old or @Jan or @Josh Larsen might have some more recent recollection
Jeremy G (Cloud Posse)
Jeremy G (Cloud Posse)over 7 years ago
@Erik Osterman (Cloud Posse) I did not delete any accounts. Not only are there lots of hoops to go through, but also deleting accounts take a long time (90 days, I think) and the account email address remains permanently associated with the "deleted" account, and therefore cannot be used on a new account.
Jeremy G (Cloud Posse)
Jeremy G (Cloud Posse)over 7 years ago
@Mike Pfaffroth What I recommend is to reuse the created accounts. Run make root up to the point where terraform complains that it cannot create the accounts, then import the accounts into Terraform using terraform import.
Mike Pfaffroth
Mike Pfaffrothover 7 years ago
interesting… I will try that approach. Appreciate the tip.
Mike Pfaffroth
Mike Pfaffrothover 7 years ago
hm… even on a brand new account I am not able to create these- it always dies when trying to create the others:
* aws_organizations_account.default: Error creating account: AccessDeniedException: You don't have permissions to access this resource.
	status code: 400, request id: 7de7c003-6846-11e9-9002-752f3d4639b5
Mike Pfaffroth
Mike Pfaffrothover 7 years ago
I changed the email address as well, just to make sure it wasn’t trying to create ones that were already there
Mike Pfaffroth
Mike Pfaffrothover 7 years ago
I am the root account:
➜  reference-architectures git:(master) ✗ aws sts get-caller-identity
{
    "UserId": "1redacted7",
    "Account": "1redacted7",
    "Arn": "arn:aws:iam::1redacted7:root"
}
Mike Pfaffroth
Mike Pfaffrothover 7 years ago
is there a special permissions I need? or is there a documentation process for signing up for an account in the right way within an organization?
S
SweetOps #geodesicover 7 years ago
There are no events this week
C
Cloud Posseover 7 years ago
Join us for "Office Hours" every Wednesday 11:30AM (PST, GMT-7).

This is an opportunity to ask us questions about INLINECODE_0, get live demos and learn from others using it. Next one is Mar 20, 2019 11:30AM.

👉️ Add it to your calendar

:zoom: https://zoom.us/j/684901853

:slack: #office-hours (our channel)