You've already forked devops-exercises
Add Argo and k8s questions
Also updated Datadog questions.
This commit is contained in:
@@ -0,0 +1,17 @@
|
||||
# Kustomize - Common Labels
|
||||
|
||||
## Requirements
|
||||
|
||||
1. Running Kubernetes cluster
|
||||
2. Kustomize binary installed
|
||||
|
||||
## Objectives
|
||||
|
||||
In the current directory there is an app composed of a Deployment and Service.
|
||||
|
||||
1. Write a kustomization.yml file that will add to both the Service and Deployment the label "team-name: aces"
|
||||
2. Execute a kustomize command that will generate the customized k8s files with the label appended
|
||||
|
||||
## Solution
|
||||
|
||||
Click [here](solution.md) to view the solution
|
||||
@@ -0,0 +1,31 @@
|
||||
# Kustomize - Common Labels
|
||||
|
||||
## Requirements
|
||||
|
||||
1. Running Kubernetes cluster
|
||||
2. Kustomize binary installed
|
||||
|
||||
## Objectives
|
||||
|
||||
In the current directory there is an app composed of a Deployment and Service.
|
||||
|
||||
1. Write a kustomization.yml file that will add to both the Service and Deployment the label "team-name: aces"
|
||||
2. Execute a kustomize command that will generate the customized k8s files with the label appended
|
||||
|
||||
## Solution
|
||||
|
||||
1. Add the following to kustomization.yml in someApp directory:
|
||||
|
||||
```
|
||||
apiVersion: kustomize.config.k8s.io/v1beta1
|
||||
kind: Kustomization
|
||||
|
||||
commonLabels:
|
||||
team-name: aces
|
||||
|
||||
resources:
|
||||
- service.yml
|
||||
- deployment.yml
|
||||
```
|
||||
|
||||
2. Run `kustomize build someApp`
|
||||
@@ -0,0 +1,21 @@
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: nginx-deployment
|
||||
labels:
|
||||
app: nginx
|
||||
spec:
|
||||
replicas: 3
|
||||
selector:
|
||||
matchLabels:
|
||||
app: nginx
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
app: nginx
|
||||
spec:
|
||||
containers:
|
||||
- name: nginx
|
||||
image: nginx:1.14.2
|
||||
ports:
|
||||
- containerPort: 80
|
||||
@@ -0,0 +1,11 @@
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: my-service
|
||||
spec:
|
||||
selector:
|
||||
app: nginx
|
||||
ports:
|
||||
- protocol: TCP
|
||||
port: 80
|
||||
targetPort: 9376
|
||||
Reference in New Issue
Block a user