-
Notifications
You must be signed in to change notification settings - Fork 35
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Laszlo Kiraly <laszlo.kiraly@est.tech>
- Loading branch information
Showing
4 changed files
with
263 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
client.yaml | ||
|
128 changes: 128 additions & 0 deletions
128
examples/features/dual-stack/Kernel2Kernel_dual_stack/README.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,128 @@ | ||
# Test kernel to kernel connection | ||
|
||
|
||
This example shows that NSC and NSE on the one node can find each other by ipv6 addresses. | ||
|
||
NSC and NSE are using the `kernel` mechanism to connect to its local forwarder. | ||
|
||
## Run | ||
|
||
Create test namespace: | ||
```bash | ||
NAMESPACE=($(kubectl create -f https://raw.githubusercontent.com/networkservicemesh/deployments-k8s/f6a529e80624810033753dc6c808a7aaaa6918ac/examples/features/namespace.yaml)[0]) | ||
NAMESPACE=${NAMESPACE:10} | ||
``` | ||
|
||
Select node to deploy NSC and NSE: | ||
```bash | ||
NODE=($(kubectl get nodes -o go-template='{{range .items}}{{ if not .spec.taints }}{{index .metadata.labels "kubernetes.io/hostname"}} {{end}}{{end}}')[0]) | ||
``` | ||
|
||
Create customization file: | ||
```bash | ||
cat > kustomization.yaml <<EOF | ||
--- | ||
apiVersion: kustomize.config.k8s.io/v1beta1 | ||
kind: Kustomization | ||
namespace: ${NAMESPACE} | ||
resources: | ||
- client.yaml | ||
bases: | ||
- ../../../../apps/nse-kernel | ||
patchesStrategicMerge: | ||
- patch-nse.yaml | ||
EOF | ||
``` | ||
|
||
Create Client: | ||
```bash | ||
cat > client.yaml <<EOF | ||
--- | ||
apiVersion: v1 | ||
kind: Pod | ||
metadata: | ||
name: alpine | ||
labels: | ||
app: alpine | ||
annotations: | ||
networkservicemesh.io: kernel://icmp-responder/nsm-1 | ||
spec: | ||
containers: | ||
- name: alpine | ||
image: alpine:3.15.0 | ||
imagePullPolicy: IfNotPresent | ||
stdin: true | ||
tty: true | ||
nodeName: ${NODE} | ||
EOF | ||
``` | ||
Create NSE patch: | ||
```bash | ||
cat > patch-nse.yaml <<EOF | ||
--- | ||
apiVersion: apps/v1 | ||
kind: Deployment | ||
metadata: | ||
name: nse-kernel | ||
spec: | ||
template: | ||
spec: | ||
containers: | ||
- name: nse | ||
env: | ||
- name: NSM_CIDR_PREFIX | ||
value: 172.16.1.100/31,2001:db8::/116 | ||
nodeName: ${NODE} | ||
EOF | ||
``` | ||
|
||
Deploy NSC and NSE: | ||
```bash | ||
kubectl apply -k . | ||
``` | ||
|
||
Wait for applications ready: | ||
```bash | ||
kubectl wait --for=condition=ready --timeout=1m pod -l app=alpine -n ${NAMESPACE} | ||
``` | ||
```bash | ||
kubectl wait --for=condition=ready --timeout=1m pod -l app=nse-kernel -n ${NAMESPACE} | ||
``` | ||
|
||
Find NSC and NSE pods by labels: | ||
```bash | ||
NSC=$(kubectl get pods -l app=alpine -n ${NAMESPACE} --template '{{range .items}}{{.metadata.name}}{{"\n"}}{{end}}') | ||
``` | ||
```bash | ||
NSE=$(kubectl get pods -l app=nse-kernel -n ${NAMESPACE} --template '{{range .items}}{{.metadata.name}}{{"\n"}}{{end}}') | ||
``` | ||
|
||
Check connectivity: | ||
```bash | ||
kubectl exec ${NSC} -n ${NAMESPACE} -- ping -c 4 2001:db8:: | ||
``` | ||
|
||
Check connectivity: | ||
```bash | ||
kubectl exec ${NSE} -n ${NAMESPACE} -- ping -c 4 2001:db8::1 | ||
``` | ||
|
||
Ping from NSC to NSE: | ||
```bash | ||
kubectl exec ${NSC} -n ${NAMESPACE} -- ping -c 4 172.16.1.100 | ||
``` | ||
|
||
Ping from NSE to NSC: | ||
```bash | ||
kubectl exec ${NSE} -n ${NAMESPACE} -- ping -c 4 172.16.1.101 | ||
``` | ||
|
||
## Cleanup | ||
|
||
Delete ns: | ||
```bash | ||
kubectl delete ns ${NAMESPACE} | ||
``` |
131 changes: 131 additions & 0 deletions
131
examples/features/dual-stack/Kernel2Wireguard2Kernel_dual_stack/README.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,131 @@ | ||
# Test kernel to wireguard to kernel connection | ||
|
||
This example shows that NSC and NSE on the different nodes could find and work with each other using IPv6. | ||
|
||
NSC and NSE are using the `kernel` mechanism to connect to its local forwarder. | ||
Forwarders are using the `wireguard` mechanism to connect with each other. | ||
|
||
## Run | ||
|
||
Create test namespace: | ||
```bash | ||
NAMESPACE=($(kubectl create -f https://raw.githubusercontent.com/networkservicemesh/deployments-k8s/f6a529e80624810033753dc6c808a7aaaa6918ac/examples/features/namespace.yaml)[0]) | ||
NAMESPACE=${NAMESPACE:10} | ||
``` | ||
|
||
Get nodes exclude control-plane: | ||
```bash | ||
NODES=($(kubectl get nodes -o go-template='{{range .items}}{{ if not .spec.taints }}{{index .metadata.labels "kubernetes.io/hostname"}} {{end}}{{end}}')) | ||
``` | ||
|
||
Create customization file: | ||
```bash | ||
cat > kustomization.yaml <<EOF | ||
--- | ||
apiVersion: kustomize.config.k8s.io/v1beta1 | ||
kind: Kustomization | ||
namespace: ${NAMESPACE} | ||
resources: | ||
- client.yaml | ||
bases: | ||
- ../../../../apps/nse-kernel | ||
patchesStrategicMerge: | ||
- patch-nse.yaml | ||
EOF | ||
``` | ||
|
||
Create Client: | ||
```bash | ||
cat > client.yaml <<EOF | ||
--- | ||
apiVersion: v1 | ||
kind: Pod | ||
metadata: | ||
name: alpine | ||
labels: | ||
app: alpine | ||
annotations: | ||
networkservicemesh.io: kernel://icmp-responder-ip/nsm-1 | ||
spec: | ||
containers: | ||
- name: alpine | ||
image: alpine:3.15.0 | ||
imagePullPolicy: IfNotPresent | ||
stdin: true | ||
tty: true | ||
nodeName: ${NODES[0]} | ||
EOF | ||
``` | ||
Create NSE patch: | ||
```bash | ||
cat > patch-nse.yaml <<EOF | ||
--- | ||
apiVersion: apps/v1 | ||
kind: Deployment | ||
metadata: | ||
name: nse-kernel | ||
spec: | ||
template: | ||
spec: | ||
containers: | ||
- name: nse | ||
env: | ||
- name: NSM_CIDR_PREFIX | ||
value: 172.16.1.100/31,2001:db8::/116 | ||
- name: NSM_PAYLOAD | ||
value: IP | ||
- name: NSM_SERVICE_NAMES | ||
value: icmp-responder-ip | ||
nodeName: ${NODES[1]} | ||
EOF | ||
``` | ||
|
||
Deploy NSC and NSE: | ||
```bash | ||
kubectl apply -k . | ||
``` | ||
|
||
Wait for applications ready: | ||
```bash | ||
kubectl wait --for=condition=ready --timeout=1m pod -l app=alpine -n ${NAMESPACE} | ||
``` | ||
```bash | ||
kubectl wait --for=condition=ready --timeout=1m pod -l app=nse-kernel -n ${NAMESPACE} | ||
``` | ||
|
||
Find NSC and NSE pods by labels: | ||
```bash | ||
NSC=$(kubectl get pods -l app=alpine -n ${NAMESPACE} --template '{{range .items}}{{.metadata.name}}{{"\n"}}{{end}}') | ||
``` | ||
```bash | ||
NSE=$(kubectl get pods -l app=nse-kernel -n ${NAMESPACE} --template '{{range .items}}{{.metadata.name}}{{"\n"}}{{end}}') | ||
``` | ||
|
||
Ping from NSC to NSE: | ||
```bash | ||
kubectl exec ${NSC} -n ${NAMESPACE} -- ping -c 4 2001:db8:: | ||
``` | ||
|
||
Ping from NSE to NSC: | ||
```bash | ||
kubectl exec ${NSE} -n ${NAMESPACE} -- ping -c 4 2001:db8::1 | ||
``` | ||
|
||
Ping from NSC to NSE: | ||
```bash | ||
kubectl exec ${NSC} -n ${NAMESPACE} -- ping -c 4 172.16.1.100 | ||
``` | ||
|
||
Ping from NSE to NSC: | ||
```bash | ||
kubectl exec ${NSE} -n ${NAMESPACE} -- ping -c 4 172.16.1.101 | ||
``` | ||
## Cleanup | ||
|
||
Delete ns: | ||
```bash | ||
kubectl delete ns ${NAMESPACE} | ||
``` |