Skip to content

Commit

Permalink
eks
Browse files Browse the repository at this point in the history
  • Loading branch information
wardviaene committed Jan 9, 2020
1 parent c72b2e7 commit c82d702
Show file tree
Hide file tree
Showing 3 changed files with 60 additions and 0 deletions.
19 changes: 19 additions & 0 deletions eks/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Setup EKS
```
eksctl create cluster --name=cluster-2 --nodes=2 --region=eu-west-1 --managed
```

# Setup IAM Roles for Service Accounts

Enable IAM Roles for Service Accounts on the EKS cluster

```
eksctl utils associate-iam-oidc-provider --cluster=cluster-2
eksctl utils associate-iam-oidc-provider --cluster=cluster-2 --approve
```

Create new IAM Role using eksctl
```
eksctl create iamserviceaccount --cluster=cluster-2 --name=myserviceaccount --namespace=default --attach-policy-arn=arn:aws:iam::aws:policy/AmazonS3ReadOnlyAccess
eksctl create iamserviceaccount --cluster=cluster-2 --name=myserviceaccount --namespace=default --attach-policy-arn=arn:aws:iam::aws:policy/AmazonS3ReadOnlyAccess --approve
```
22 changes: 22 additions & 0 deletions eks/amazonlinux-nonroot.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: amazonlinux
spec:
replicas: 1
selector:
matchLabels:
app: amazonlinux
template:
metadata:
labels:
app: amazonlinux
spec:
serviceAccount: myserviceaccount
securityContext:
fsGroup: 1000
runAsUser: 1000
containers:
- name: amazonlinux
image: amazonlinux:2
command: ["sleep", "infinity"]
19 changes: 19 additions & 0 deletions eks/amazonlinux.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: amazonlinux
spec:
replicas: 1
selector:
matchLabels:
app: amazonlinux
template:
metadata:
labels:
app: amazonlinux
spec:
serviceAccount: myserviceaccount
containers:
- name: amazonlinux
image: amazonlinux:2
command: ["sleep", "infinity"]

0 comments on commit c82d702

Please sign in to comment.