mirror of
https://github.com/wardviaene/kubernetes-course.git
synced 2026-02-14 17:49:56 +00:00
eks
This commit is contained in:
19
eks/README.md
Normal file
19
eks/README.md
Normal file
@@ -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
eks/amazonlinux-nonroot.yaml
Normal file
22
eks/amazonlinux-nonroot.yaml
Normal file
@@ -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
eks/amazonlinux.yaml
Normal file
19
eks/amazonlinux.yaml
Normal file
@@ -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"]
|
||||
Reference in New Issue
Block a user