新增learn-kubernetes(https://github.com/yyong-brs/learn-kubernetes)相关文件
This commit is contained in:
@@ -0,0 +1,162 @@
|
||||
---
|
||||
kind: ConfigMap
|
||||
apiVersion: v1
|
||||
metadata:
|
||||
name: kube-flannel-windows-cfg
|
||||
namespace: kube-system
|
||||
labels:
|
||||
tier: node
|
||||
app: flannel
|
||||
data:
|
||||
run.ps1: |
|
||||
$ErrorActionPreference = "Stop";
|
||||
|
||||
mkdir -force /host/etc/cni/net.d
|
||||
mkdir -force /host/etc/kube-flannel
|
||||
mkdir -force /host/opt/cni/bin
|
||||
mkdir -force /host/k/flannel
|
||||
mkdir -force /host/k/flannel/var/run/secrets/kubernetes.io/serviceaccount
|
||||
|
||||
$cniJson = get-content /etc/kube-flannel-windows/cni-conf.json | ConvertFrom-Json
|
||||
$serviceSubnet = yq r /etc/kubeadm-config/ClusterConfiguration networking.serviceSubnet
|
||||
$podSubnet = yq r /etc/kubeadm-config/ClusterConfiguration networking.podSubnet
|
||||
$networkJson = wins cli net get | convertfrom-json
|
||||
|
||||
$cniJson.delegate.policies[0].Value.ExceptionList = $serviceSubnet, $podSubnet
|
||||
$cniJson.delegate.policies[1].Value.DestinationPrefix = $serviceSubnet
|
||||
Set-Content -Path /host/etc/cni/net.d/10-flannel.conf ($cniJson | ConvertTo-Json -depth 100)
|
||||
|
||||
cp -force /etc/kube-flannel/net-conf.json /host/etc/kube-flannel
|
||||
cp -force -recurse /cni/* /host/opt/cni/bin
|
||||
cp -force /k/flannel/* /host/k/flannel/
|
||||
cp -force /kube-proxy/kubeconfig.conf /host/k/flannel/kubeconfig.yml
|
||||
cp -force /var/run/secrets/kubernetes.io/serviceaccount/* /host/k/flannel/var/run/secrets/kubernetes.io/serviceaccount/
|
||||
wins cli process run --path /k/flannel/setup.exe --args "--mode=overlay --interface=Ethernet"
|
||||
wins cli route add --addresses 169.254.169.254
|
||||
wins cli process run --path /k/flannel/flanneld.exe --args "--kube-subnet-mgr --kubeconfig-file /k/flannel/kubeconfig.yml" --envs "POD_NAME=$env:POD_NAME POD_NAMESPACE=$env:POD_NAMESPACE"
|
||||
cni-conf.json: |
|
||||
{
|
||||
"name": "flannel.4096",
|
||||
"cniVersion": "0.3.0",
|
||||
"type": "flannel",
|
||||
"capabilities": {
|
||||
"dns": true
|
||||
},
|
||||
"delegate": {
|
||||
"type": "win-overlay",
|
||||
"policies": [
|
||||
{
|
||||
"Name": "EndpointPolicy",
|
||||
"Value": {
|
||||
"Type": "OutBoundNAT",
|
||||
"ExceptionList": []
|
||||
}
|
||||
},
|
||||
{
|
||||
"Name": "EndpointPolicy",
|
||||
"Value": {
|
||||
"Type": "ROUTE",
|
||||
"DestinationPrefix": "",
|
||||
"NeedEncap": true
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
---
|
||||
apiVersion: apps/v1
|
||||
kind: DaemonSet
|
||||
metadata:
|
||||
name: kube-flannel-ds-windows-amd64
|
||||
labels:
|
||||
tier: node
|
||||
app: flannel
|
||||
namespace: kube-system
|
||||
spec:
|
||||
selector:
|
||||
matchLabels:
|
||||
app: flannel
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
tier: node
|
||||
app: flannel
|
||||
spec:
|
||||
affinity:
|
||||
nodeAffinity:
|
||||
requiredDuringSchedulingIgnoredDuringExecution:
|
||||
nodeSelectorTerms:
|
||||
- matchExpressions:
|
||||
- key: kubernetes.io/os
|
||||
operator: In
|
||||
values:
|
||||
- windows
|
||||
- key: kubernetes.io/arch
|
||||
operator: In
|
||||
values:
|
||||
- amd64
|
||||
hostNetwork: true
|
||||
serviceAccountName: flannel
|
||||
tolerations:
|
||||
- operator: Exists
|
||||
effect: NoSchedule
|
||||
containers:
|
||||
- name: kube-flannel
|
||||
image: sigwindowstools/flannel:0.12.0
|
||||
command:
|
||||
- powershell
|
||||
args:
|
||||
- -file
|
||||
- /etc/kube-flannel-windows/run.ps1
|
||||
volumeMounts:
|
||||
- name: wins
|
||||
mountPath: \\.\pipe\rancher_wins
|
||||
- name: host
|
||||
mountPath: /host
|
||||
- name: kube-proxy
|
||||
mountPath: /kube-proxy
|
||||
- name: cni
|
||||
mountPath: /etc/cni/net.d
|
||||
- name: flannel-cfg
|
||||
mountPath: /etc/kube-flannel/
|
||||
- name: flannel-windows-cfg
|
||||
mountPath: /etc/kube-flannel-windows/
|
||||
- name: kubeadm-config
|
||||
mountPath: /etc/kubeadm-config/
|
||||
env:
|
||||
- name: POD_NAME
|
||||
valueFrom:
|
||||
fieldRef:
|
||||
apiVersion: v1
|
||||
fieldPath: metadata.name
|
||||
- name: POD_NAMESPACE
|
||||
valueFrom:
|
||||
fieldRef:
|
||||
apiVersion: v1
|
||||
fieldPath: metadata.namespace
|
||||
volumes:
|
||||
- name: opt
|
||||
hostPath:
|
||||
path: /opt
|
||||
- name: host
|
||||
hostPath:
|
||||
path: /
|
||||
- name: cni
|
||||
hostPath:
|
||||
path: /etc
|
||||
- name: flannel-cfg
|
||||
configMap:
|
||||
name: kube-flannel-cfg
|
||||
- name: flannel-windows-cfg
|
||||
configMap:
|
||||
name: kube-flannel-windows-cfg
|
||||
- name: kube-proxy
|
||||
configMap:
|
||||
name: kube-proxy
|
||||
- name: kubeadm-config
|
||||
configMap:
|
||||
name: kubeadm-config
|
||||
- name: wins
|
||||
hostPath:
|
||||
path: \\.\pipe\rancher_wins
|
||||
type: null
|
||||
Reference in New Issue
Block a user