Tips tutorial custom networking - eBay eks

dinhtrungdave

New member
#Ebay #CustomNetWorking #Kubernetes #tutorial #Eks ## Cách tạo mạng tùy chỉnh trong eBay EKS

Hướng dẫn này sẽ chỉ cho bạn cách tạo một mạng tùy chỉnh trong eBay EKS.Một mạng tùy chỉnh cho phép bạn điều khiển cấu hình mạng của các nhóm của bạn, bao gồm các mạng con, cidrs mạng con và cổng.Điều này có thể hữu ích vì nhiều lý do, chẳng hạn như:

* Cách ly vỏ của bạn với phần còn lại của cụm
* Tạo một mạng riêng cho nhóm của bạn
* Kết nối vỏ của bạn với một mạng con hoặc cổng cụ thể

Để bắt đầu, bạn sẽ cần phải có những điều sau:

* Một cụm eks ebay
* Công cụ Kubectl CLI

Khi bạn có những thứ đó, bạn có thể làm theo các bước này để tạo một mạng tùy chỉnh:

1. Tạo một không gian tên mới cho mạng tùy chỉnh của bạn.

`` `
Kubectl Tạo không gian tên tùy chỉnh mạng
`` `

2. Tạo chính sách mạng mới cho mạng tùy chỉnh của bạn.

`` `
CAT << EOF |kubectl áp dụng -f -
Apiversion: Mạng.K8s.io/v1
Kind: Mạng lưới
metadata:
Tên: Chính sách mạng tùy chỉnh
Không gian tên: Mạng tùy chỉnh
Thông số:
Podselector:
Matchlabels:
Ứng dụng: app của tôi
xâm nhập:
- từ:
- Podselector:
Matchlabels:
Ứng dụng: My-DB
- Podselector:
Matchlabels:
Ứng dụng: My-Cache
EOF
`` `

3. Tạo một mạng con mới cho mạng tùy chỉnh của bạn.

`` `
Kubectl Tạo mạng con 10.10.0.0/16-CLUSTER-NAME My Cluster-Node-Name My-Node
`` `

4. Tạo một cổng mới cho mạng tùy chỉnh của bạn.

`` `
KUBECTL Tạo cổng 10.10.0.1-CLUSTER-MAME My Cluster-Node-name My-Node
`` `

5. Thêm các chú thích sau vào thông số Pod của bạn:

`` `
Chú thích:
kubernetes.io/network/custom-network: "Đúng"
kubernetes.io/network/custom-subnet: "10.10.0.0/16"
kubernetes.io/network/custom-gateway: "10.10.0.1"
`` `

6. Triển khai POD của bạn vào mạng tùy chỉnh.

`` `
kubectl Ứng dụng -f pod.yaml
`` `

Khi nhóm của bạn được triển khai, bạn có thể xác minh rằng nó đang sử dụng mạng tùy chỉnh bằng cách chạy lệnh sau:

`` `
kubectl get pod my -pod -o jsonpath = "{. spec.networks [0] .name}"
`` `

Đầu ra của lệnh này phải là "mạng tùy chỉnh".

## 5 hashtags

* #Ebay
* #CustomNetWorking
* #Kubernetes
* #tutorial
* #Eks
=======================================
#Ebay #CustomNetWorking #Kubernetes #tutorial #Eks ## How to Create a Custom Network in eBay EKS

This tutorial will show you how to create a custom network in eBay EKS. A custom network allows you to control the networking configuration of your pods, including the subnets, subnets CIDRs, and gateways. This can be useful for a variety of reasons, such as:

* Isolating your pods from the rest of the cluster
* Creating a private network for your pods
* Connecting your pods to a specific subnet or gateway

To get started, you will need to have the following:

* An eBay EKS cluster
* The kubectl CLI tool

Once you have those, you can follow these steps to create a custom network:

1. Create a new namespace for your custom network.

```
kubectl create namespace custom-network
```

2. Create a new network policy for your custom network.

```
cat <<EOF | kubectl apply -f -
apiVersion: networking.k8s.io/v1
kind: NetworkPolicy
metadata:
name: custom-network-policy
namespace: custom-network
spec:
podSelector:
matchLabels:
app: my-app
ingress:
- from:
- podSelector:
matchLabels:
app: my-db
- podSelector:
matchLabels:
app: my-cache
EOF
```

3. Create a new subnet for your custom network.

```
kubectl create subnet 10.10.0.0/16 --cluster-name my-cluster --node-name my-node
```

4. Create a new gateway for your custom network.

```
kubectl create gateway 10.10.0.1 --cluster-name my-cluster --node-name my-node
```

5. Add the following annotations to your pod spec:

```
annotations:
kubernetes.io/network/custom-network: "true"
kubernetes.io/network/custom-subnet: "10.10.0.0/16"
kubernetes.io/network/custom-gateway: "10.10.0.1"
```

6. Deploy your pod to the custom network.

```
kubectl apply -f pod.yaml
```

Once your pod is deployed, you can verify that it is using the custom network by running the following command:

```
kubectl get pod my-pod -o jsonpath="{.spec.networks[0].name}"
```

The output of this command should be "custom-network".

## 5 Hashtags

* #Ebay
* #CustomNetWorking
* #Kubernetes
* #tutorial
* #Eks
 
Join Telegram ToolsKiemTrieuDoGroup
Back
Top