Commit 907a8e4f by tingweiwang

hello

0 parents
File mode changed
#!/usr/bin/env bash
set -o errexit
readonly caPath=${CA_PATH:-/etc/kubeedge/ca}
readonly caSubject=${CA_SUBJECT:-/C=CN/ST=Zhejiang/L=Hangzhou/O=KubeEdge/CN=kubeedge.io}
readonly certPath=${CERT_PATH:-/etc/kubeedge/certs}
readonly subject=${SUBJECT:-/C=CN/ST=Zhejiang/L=Hangzhou/O=KubeEdge/CN=kubeedge.io}
genCA() {
openssl genrsa -des3 -out ${caPath}/rootCA.key -passout pass:kubeedge.io 4096
openssl req -x509 -new -nodes -key ${caPath}/rootCA.key -sha256 -days 3650 \
-subj ${subject} -passin pass:kubeedge.io -out ${caPath}/rootCA.crt
}
ensureCA() {
if [ ! -e ${caPath}/rootCA.key ] || [ ! -e ${caPath}/rootCA.crt ]; then
genCA
fi
}
ensureFolder() {
if [ ! -d ${caPath} ]; then
mkdir -p ${caPath}
fi
if [ ! -d ${certPath} ]; then
mkdir -p ${certPath}
fi
}
genCsr() {
local name=$1
openssl genrsa -out ${certPath}/${name}.key 2048
openssl req -new -key ${certPath}/${name}.key -subj ${subject} -out ${certPath}/${name}.csr
}
genCert() {
local name=$1
openssl x509 -req -in ${certPath}/${name}.csr -CA ${caPath}/rootCA.crt -CAkey ${caPath}/rootCA.key \
-CAcreateserial -passin pass:kubeedge.io -out ${certPath}/${name}.crt -days 365 -sha256
}
genCertAndKey() {
ensureFolder
ensureCA
local name=$1
genCsr $name
genCert $name
}
stream() {
readonly streamsubject=${SUBJECT:-/C=CN/ST=Zhejiang/L=Hangzhou/O=KubeEdge}
readonly STREAM_KEY_FILE=${certPath}/stream.key
readonly STREAM_CSR_FILE=${certPath}/stream.csr
readonly STREAM_CRT_FILE=${certPath}/stream.crt
readonly K8SCA_FILE=/etc/kubernetes/pki/ca.crt
readonly K8SCA_KEY_FILE=/etc/kubernetes/pki/ca.key
if [ -z ${CLOUDCOREIPS} ]; then
echo "You must set CLOUDCOREIPS Env,The environment variable is set to specify the IP addresses of all cloudcore"
echo "If there are more than one IP need to be separated with space."
exit 1
fi
index=1
SUBJECTALTNAME="subjectAltName = IP.1:127.0.0.1"
for ip in ${CLOUDCOREIPS}; do
SUBJECTALTNAME="${SUBJECTALTNAME},"
index=$(($index+1))
SUBJECTALTNAME="${SUBJECTALTNAME}IP.${index}:${ip}"
done
cp /etc/kubernetes/pki/ca.crt ${caPath}/streamCA.crt
echo $SUBJECTALTNAME > /tmp/server-extfile.cnf
openssl genrsa -out ${STREAM_KEY_FILE} 2048
openssl req -new -key ${STREAM_KEY_FILE} -subj ${streamsubject} -out ${STREAM_CSR_FILE}
# verify
openssl req -in ${STREAM_CSR_FILE} -noout -text
openssl x509 -req -in ${STREAM_CSR_FILE} -CA ${K8SCA_FILE} -CAkey ${K8SCA_KEY_FILE} -CAcreateserial -out ${STREAM_CRT_FILE} -days 5000 -sha256 -extfile /tmp/server-extfile.cnf
#verify
openssl x509 -in ${STREAM_CRT_FILE} -text -noout
}
buildSecret() {
local name="edge"
genCertAndKey ${name} > /dev/null 2>&1
cat <<EOF
apiVersion: v1
kind: Secret
metadata:
name: cloudcore
namespace: kubeedge
labels:
k8s-app: kubeedge
kubeedge: cloudcore
stringData:
rootCA.crt: |
$(pr -T -o 4 ${caPath}/rootCA.crt)
edge.crt: |
$(pr -T -o 4 ${certPath}/${name}.crt)
edge.key: |
$(pr -T -o 4 ${certPath}/${name}.key)
EOF
}
$1 $2
The file could not be displayed because it is too large.
The file could not be displayed because it is too large.
The file could not be displayed because it is too large.
apiVersion: apiextensions.k8s.io/v1beta1
kind: CustomResourceDefinition
metadata:
labels:
controller-tools.k8s.io: "1.0"
name: devices.devices.kubeedge.io
spec:
group: devices.kubeedge.io
names:
kind: Device
plural: devices
scope: Namespaced
validation:
openAPIV3Schema:
properties:
apiVersion:
description: 'APIVersion defines the versioned schema of this representation
of an object. Servers should convert recognized schemas to the latest
internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#resources'
type: string
kind:
description: 'Kind is a string value representing the REST resource this
object represents. Servers may infer this from the endpoint the client
submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#types-kinds'
type: string
metadata:
type: object
spec:
properties:
deviceModelRef:
description: 'Required: DeviceModelRef is reference to the device model
used as a template to create the device instance.'
type: object
nodeSelector:
description: NodeSelector indicates the binding preferences between
devices and nodes. Refer to k8s.io/kubernetes/pkg/apis/core NodeSelector
for more details
type: object
protocol:
description: 'Required: The protocol configuration used to connect to
the device.'
properties:
bluetooth:
description: Protocol configuration for bluetooth
properties:
macAddress:
description: Unique identifier assigned to the device.
type: string
type: object
modbus:
description: Protocol configuration for modbus
properties:
rtu:
properties:
baudRate:
description: Required. BaudRate 115200|57600|38400|19200|9600|4800|2400|1800|1200|600|300|200|150|134|110|75|50
format: int64
type: integer
enum:
- 115200
- 57600
- 38400
- 19200
- 9600
- 4800
- 2400
- 1800
- 1200
- 600
- 300
- 200
- 150
- 134
- 110
- 75
- 50
dataBits:
description: Required. Valid values are 8, 7, 6, 5.
format: int64
type: integer
enum:
- 8
- 7
- 6
- 5
parity:
description: Required. Valid options are "none", "even",
"odd". Defaults to "none".
type: string
enum:
- none
- even
- odd
serialPort:
description: Required.
type: string
slaveID:
description: Required. 0-255
format: int64
type: integer
minimum: 0
maximum: 255
stopBits:
description: Required. Bit that stops 1|2
format: int64
type: integer
enum:
- 1
- 2
required:
- baudRate
- dataBits
- parity
- serialPort
- slaveID
- stopBits
type: object
tcp:
properties:
ip:
description: Required.
type: string
port:
description: Required.
format: int64
type: integer
slaveID:
description: Required.
type: string
required:
- ip
- port
- slaveID
type: object
type: object
opcua:
description: Protocol configuration for opc-ua
properties:
certificate:
description: Certificate for access opc server.
type: string
password:
description: Password for access opc server.
type: string
privateKey:
description: PrivateKey for access opc server.
type: string
securityMode:
description: Defaults to "none".
type: string
securityPolicy:
description: Defaults to "none".
type: string
timeout:
description: Timeout seconds for the opc server connection.???
format: int64
type: integer
url:
description: 'Required: The URL for opc server endpoint.'
type: string
userName:
description: Username for access opc server.
type: string
required:
- url
type: object
type: object
required:
- deviceModelRef
type: object
status:
properties:
twins:
description: A list of device twins containing desired/reported desired/reported
values of twin properties. A passive device won't have twin properties
and this list could be empty.
items:
properties:
desired:
description: 'Required: the desired property value.'
properties:
metadata:
description: Additional metadata like timestamp when the value
was reported etc.
type: object
value:
description: 'Required: The value for this property.'
type: string
required:
- value
type: object
propertyName:
description: 'Required: The property name for which the desired/reported
values are specified. This property should be present in the
device model.'
type: string
reported:
description: 'Required: the reported property value.'
properties:
metadata:
description: Additional metadata like timestamp when the value
was reported etc.
type: object
value:
description: 'Required: The value for this property.'
type: string
required:
- value
type: object
required:
- propertyName
type: object
type: array
type: object
version: v1alpha1
apiVersion: apiextensions.k8s.io/v1beta1
kind: CustomResourceDefinition
metadata:
labels:
controller-tools.k8s.io: "1.0"
name: clusterobjectsyncs.reliablesyncs.kubeedge.io
spec:
group: reliablesyncs.kubeedge.io
names:
kind: ClusterObjectSync
plural: clusterobjectsyncs
scope: Cluster
subresources:
status: {}
validation:
openAPIV3Schema:
properties:
apiVersion:
description: 'APIVersion defines the versioned schema of this representation
of an object. Servers should convert recognized schemas to the latest
internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#resources'
type: string
kind:
description: 'Kind is a string value representing the REST resource this
object represents. Servers may infer this from the endpoint the client
submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#types-kinds'
type: string
metadata:
type: object
spec:
properties:
objectType:
description: NodeSelector indicates the binding preferences between
devices and nodes. Refer to k8s.io/kubernetes/pkg/apis/core NodeSelector
for more details
type: string
objectName:
description: 'Required: The protocol configuration used to connect to
the device.'
type: string
status:
properties:
objectResourceVersion:
description: 'Required: DeviceModelRef is reference to the device model
used as a template to create the device instance.'
type: string
version: v1alpha1
\ No newline at end of file
apiVersion: apiextensions.k8s.io/v1beta1
kind: CustomResourceDefinition
metadata:
labels:
controller-tools.k8s.io: "1.0"
name: objectsyncs.reliablesyncs.kubeedge.io
spec:
group: reliablesyncs.kubeedge.io
names:
kind: ObjectSync
plural: objectsyncs
scope: Namespaced
subresources:
status: {}
validation:
openAPIV3Schema:
properties:
apiVersion:
description: 'APIVersion defines the versioned schema of this representation
of an object. Servers should convert recognized schemas to the latest
internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#resources'
type: string
kind:
description: 'Kind is a string value representing the REST resource this
object represents. Servers may infer this from the endpoint the client
submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#types-kinds'
type: string
metadata:
type: object
spec:
properties:
objectType:
description: NodeSelector indicates the binding preferences between
devices and nodes. Refer to k8s.io/kubernetes/pkg/apis/core NodeSelector
for more details
type: string
objectName:
description: 'Required: The protocol configuration used to connect to
the device.'
type: string
status:
properties:
objectResourceVersion:
description: 'Required: DeviceModelRef is reference to the device model
used as a template to create the device instance.'
type: string
version: v1alpha1
\ No newline at end of file
The file could not be displayed because it is too large.
apiVersion: apps/v1
kind: Deployment
metadata:
name: nginx-deployment
labels:
app: nginx
spec:
replicas: 1
selector:
matchLabels:
app: nginx
template:
metadata:
labels:
app: nginx
spec:
containers:
- name: nginx
image: nginx:1.15.12
ports:
- containerPort: 80
hostPort: 80
# With --minconfig , you can easily used this configurations as reference.
# It's useful to users who are new to KubeEdge, and you can modify/create your own configs accordingly.
# This configuration is suitable for beginners.
apiVersion: cloudcore.config.kubeedge.io/v1alpha1
kind: CloudCore
kubeAPIConfig:
kubeConfig: /root/.kube/config
master: "https://{{MASTER_IP}}:6443" #master api 地址
leaderelection:
LeaderElect: false
LeaseDuration: 0s
RenewDeadline: 0s
ResourceLock: ""
ResourceName: ""
ResourceNamespace: ""
RetryPeriod: 0s
modules:
cloudHub:
advertiseAddress:
- {{MASTER_IP}} #cloud server 地址
https:
address: 0.0.0.0
enable: true
port: 10002
nodeLimit: 10
tlsCAFile: /etc/kubeedge/ca/rootCA.crt
tlsCAKeyFile: /etc/kubeedge/ca/rootCA.key
tlsCertFile: /etc/kubeedge/certs/server.crt
tlsPrivateKeyFile: /etc/kubeedge/certs/server.key
unixsocket:
address: unix:///var/lib/kubeedge/kubeedge.sock
enable: true
websocket:
address: 0.0.0.0
enable: true
port: 10000
# With --minconfig , you can easily used this configurations as reference.
# It's useful to users who are new to KubeEdge, and you can modify/create your own configs accordingly.
# This configuration is suitable for beginners.
apiVersion: edgecore.config.kubeedge.io/v1alpha1
database:
dataSource: /var/lib/kubeedge/edgecore.db
kind: EdgeCore
modules:
edgeHub:
heartbeat: 15
httpServer: https://192.168.137.201:10002
tlsCaFile: /etc/kubeedge/ca/rootCA.crt
tlsCertFile: /etc/kubeedge/certs/server.crt
tlsPrivateKeyFile: /etc/kubeedge/certs/server.key
token: "08ce39b001305c78fcc96c3dceb65d9ab0b1ca8ff7fa2793f956b1c17af62fd7.eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJleHAiOjE1OTQyNjY4Mjh9.7M1Yt-E-qJQHvfsPPnkJkqvmaOIU0eoxRYF-tnQLklw"
websocket:
enable: true
handshakeTimeout: 30
readDeadline: 15
server: 192.168.137.201:10000
writeDeadline: 15
edged:
cgroupDriver: cgroupfs
cgroupRoot: ""
cgroupsPerQOS: true
clusterDNS: ""
clusterDomain: ""
devicePluginEnabled: false
dockerAddress: unix:///var/run/docker.sock
gpuPluginEnabled: false
hostnameOverride: seetaas-cpu-200
interfaceName: ens33
nodeIP: 192.168.137.200
podSandboxImage: kubeedge/pause:3.1
remoteImageEndpoint: unix:///var/run/dockershim.sock
remoteRuntimeEndpoint: unix:///var/run/dockershim.sock
runtimeType: docker
eventBus:
mqttMode: 2
mqttQOS: 0
mqttRetain: false
mqttServerExternal: tcp://127.0.0.1:1883
mqttServerInternal: tcp://127.0.0.1:1884
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!