Skip to content

Commit

Permalink
Update examples (#19)
Browse files Browse the repository at this point in the history
Signed-off-by: rasel <[email protected]>
  • Loading branch information
Superm4n97 authored Feb 24, 2023
1 parent 5d3e475 commit 9f6b37c
Show file tree
Hide file tree
Showing 13 changed files with 152 additions and 28 deletions.
10 changes: 6 additions & 4 deletions examples/aws-credential.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
### Create credential file
The file must be named as `credentials`, you can create credential file from command line as,
```
First, you have to add a credential file using AWS secrets,
```bash
cat <<-EOF > /local/path/to/credentials
[default]
Expand All @@ -10,9 +10,11 @@ EOF
```

### Create secret from file
Use the `credentials` file to create secret:
Use the above file to create a secret:
```bash
kubectl create secret generic aws-credential --namespace demo --from-file /local/path/to/credentials
```

The secret must be in the same namespace as the External-DNS
The secret must be in the same **namespace** as the External-DNS

You can use this secret to create records in the AWS provider. The secret name should be used against `spec.aws.secretRef.name` field and secret key against `spec.aws.secretRef.credentialKey`
13 changes: 8 additions & 5 deletions examples/azure-credential.md
Original file line number Diff line number Diff line change
@@ -1,21 +1,24 @@
### Create credential file
The file must be named as `azure.json`, you can create the file by:
```
You have to create a JSON credential file for Azure Provider:
```bash
cat <<-EOF > /local/path/to/azure.json
{
"tenantId": "your-azure-tenant-id",
"subscriptionId": "your-azure-subscription-id",
"resourceGroup": "your-azure-resource-group-name",
"useManagedIdentityExtension": true
"aadClientId": "your-azure-client-id",
"aadClientSecret": "your-azure-client-password"
}
EOF
```

### Create secret from file
Use the `azure.json` file to create Kubernetes secret:
Use the JSON file to create a secret.

```shell
kubectl create secret generic azure-credential --namespace demo --from-file /local/path/to/azure.json
```

The secret must be in the same namespace as the External-DNS
The secret must be in the same namespace as the External-DNS

This secret name and secret key will be used in `spec.azure.secretRef.name` and `spec.azure.secretRef.credentialKey`
7 changes: 6 additions & 1 deletion examples/cloudflare-secret.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,9 @@ stringData:
kind: Secret
metadata:
name: cloudflare-credential
namespace: demo #must be in the same namespace as External-DNS
namespace: demo #must be in the same namespace as External-DNS

#this secret name will be used in spec.cloudflare.secretRef.name

#and secret key in spec.cloudflare.secretRef.apiToken
#you can use api token otherwise api key and api email
6 changes: 3 additions & 3 deletions examples/google-credential.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
### Create Secret from `credentials.json`
### Create Secret from
Create a Kubernetes secret with the credentials in the same namespace of External-DNS operator.
```shell
kubectl create secret generic "google-credential" --namespace demo --from-file /local/path/to/credentials.json
kubectl create secret generic google-credential --namespace demo --from-file /local/path/to/credentials.json
```
The file containing the GKE credentials must be named as `credentials.json`
The name and key of this secret will be used in `spec.google.secretRef.name` and `spec.google.secretRef.credentialKey`
7 changes: 4 additions & 3 deletions examples/node-aws.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@ metadata:
name: aws-edns-node
namespace: demo
spec:
providerSecretRef:
name: aws-credential
source:
type:
group: ""
Expand All @@ -18,9 +16,12 @@ spec:
registry: txt
txtOwnerID: external-dns
txtPrefix: xyz
provider: aws
domainFilter:
- example.com
policy: upsert-only
provider: aws
aws:
zoneType: public
secretRef:
name: aws-credential
credentialKey: credentials
14 changes: 8 additions & 6 deletions examples/node-azure.yaml
Original file line number Diff line number Diff line change
@@ -1,23 +1,25 @@
apiVersion: external-dns.appscode.com/v1alpha1
kind: ExternalDNS
metadata:
name: azure-nodes
name: node.example.com
namespace: demo
spec:
providerSecretRef:
name: azure-credential
source:
type:
group: ""
version: v1
kind: Node
node:
labelFilter: app=demo-node
annotationFilter: lke.linode.com/wgip=0.0.0.0
labelFilter: app=demo-node #sample label filter format
annotationFilter: lke.linode.com/wgip=0.0.0.0 #sample annotation filter format
fqdnTemplate: node.example.com
registry: txt
txtOwnerID: external-dns
txtPrefix: xyz
provider: azure
domainFilter:
- example.com
provider: azure
azure:
secretRef:
name: azure-credential
credentialKey: azure.json
8 changes: 5 additions & 3 deletions examples/node-cloudflare.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@ metadata:
name: cloudflare-nodes
namespace: demo
spec:
providerSecretRef:
name: cloudflare-credential
source:
type:
group: ""
Expand All @@ -18,6 +16,10 @@ spec:
registry: txt
txtOwnerID: external-dns
txtPrefix: xyz
provider: cloudflare
domainFilter:
- example.com
provider: cloudflare
cloudflare:
secretRef:
name: cloudflare-credentials
apiToken: CF_API_TOKEN
9 changes: 6 additions & 3 deletions examples/nodes-google.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,12 @@ spec:
registry: txt
txtOwnerID: external-dns
txtPrefix: xyz
provider: google
google:
project: project-name
domainFilter:
- example.com
policy: upsert-only
provider: google
google:
project: project-name
secretRef:
name: google-credential
credentialKey: credentials.json
8 changes: 8 additions & 0 deletions examples/webinar-20230111/aws-credential.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
apiVersion: v1
data:
credentials: awsbase64encodedcredentialdata
kind: Secret
metadata:
name: aws-credential
namespace: demo
type: Opaque
26 changes: 26 additions & 0 deletions examples/webinar-20230111/aws-node.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
apiVersion: external-dns.appscode.com/v1alpha1
kind: ExternalDNS
metadata:
name: aws-edns-node
namespace: demo
spec:
source:
type:
group: ""
version: v1
kind: Node
node:
#annotationFilter: lke.linode.com/wgip=172.31.2.1
fqdnTemplate: node.appscode.info
registry: txt
txtOwnerID: external-dns
txtPrefix: xyz
policy: sync
provider: aws
domainFilter:
- appscode.info
aws:
zoneType: public
secretRef:
name: aws-credential
credentialKey: credentials
42 changes: 42 additions & 0 deletions examples/webinar-20230111/dep-svc.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
---
# Deployment
apiVersion: apps/v1
kind: Deployment
metadata:
name: demo-dep
namespace: demo
labels:
app: nginx
spec:
replicas: 1
selector:
matchLabels:
app: nginx
template:
metadata:
labels:
app: nginx
spec:
containers:
- name: nginx
image: nginx:1.14.2
ports:
- containerPort: 80
---
# Service
apiVersion: v1
kind: Service
metadata:
name: demo-svc-lb
namespace: demo
annotations:
external-dns.alpha.kubernetes.io/hostname: service.appscode.info #for Service, you have to add this annotation to specify fully qualified domain name
labels:
app: demo-svc
spec:
type: LoadBalancer
selector:
app: nginx
ports:
- port: 80
targetPort: 80
8 changes: 8 additions & 0 deletions examples/webinar-20230111/google-cred.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
apiVersion: v1
data:
credentials.json: base64encodedgooglecredentials
kind: Secret
metadata:
name: google-cred
namespace: demo
type: Opaque
22 changes: 22 additions & 0 deletions examples/webinar-20230111/google-service.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
apiVersion: external-dns.appscode.com/v1alpha1
kind: ExternalDNS
metadata:
name: google-edns-node
namespace: demo
spec:
source:
type:
group: ""
version: v1
kind: Service
registry: txt
txtOwnerID: external-dns
txtPrefix: service
provider: google
domainFilter:
- appscode.info
google:
project: appscode-testing
secretRef:
name: google-cred
credentialKey: credentials.json

0 comments on commit 9f6b37c

Please sign in to comment.