fix
This commit is contained in:
parent
3321a59e23
commit
f7106da0ab
@ -32,6 +32,19 @@
|
|||||||
#Define Admin user and Password
|
#Define Admin user and Password
|
||||||
#http POST http://localhost:9000/api/users/admin/init Username="portainer" Password="portainer1234"
|
#http POST http://localhost:9000/api/users/admin/init Username="portainer" Password="portainer1234"
|
||||||
|
|
||||||
|
#Add the portainer user to the docker group
|
||||||
|
#usermod -aG docker portainer && newgrp docker
|
||||||
|
|
||||||
|
#Start minikube
|
||||||
|
#sudo -u portainer minikube start --nodes 2 --driver=none
|
||||||
|
|
||||||
|
#Add the metrics server to the minikube cluster
|
||||||
|
#sudo -u portainer minikube addons enable metrics-server
|
||||||
|
|
||||||
|
#Add Portainer Agent to the local kind Kubernetes cluster
|
||||||
|
# curl -L https://downloads.portainer.io/portainer-agent-k8s-nodeport.yaml -o portainer-agent-k8s.yaml; kubectl apply -f portainer-agent-k8s.yaml
|
||||||
|
#sleep 15
|
||||||
|
|
||||||
#Get the admin JWT token
|
#Get the admin JWT token
|
||||||
#http POST :9000/api/auth Username="portainer" Password="portainer1234"
|
#http POST :9000/api/auth Username="portainer" Password="portainer1234"
|
||||||
#jwt=`http POST :9000/api/auth Username="portainer" Password="portainer1234" | jq '.jwt' | sed 's/^.//' | sed 's/.$//'`
|
#jwt=`http POST :9000/api/auth Username="portainer" Password="portainer1234" | jq '.jwt' | sed 's/^.//' | sed 's/.$//'`
|
||||||
@ -41,20 +54,7 @@
|
|||||||
#"Authorization: Bearer $jwt" \
|
#"Authorization: Bearer $jwt" \
|
||||||
#Name="docker" EndpointCreationType=1
|
#Name="docker" EndpointCreationType=1
|
||||||
|
|
||||||
#Add the portainer user to the docker group
|
|
||||||
usermod -aG docker portainer && newgrp docker
|
|
||||||
|
|
||||||
#Start minikube
|
|
||||||
sudo -u portainer minikube start
|
|
||||||
|
|
||||||
#Add the metrics server to the minikube cluster
|
|
||||||
sudo -u portainer minikube addons enable metrics-server
|
|
||||||
|
|
||||||
#Add Portainer Agent to the local kind Kubernetes cluster
|
|
||||||
# curl -L https://downloads.portainer.io/portainer-agent-k8s-nodeport.yaml -o portainer-agent-k8s.yaml; kubectl apply -f portainer-agent-k8s.yaml
|
|
||||||
#sleep 30
|
|
||||||
|
|
||||||
#Add local Kubernetes endpoint
|
#Add local Kubernetes endpoint
|
||||||
#http --form POST :9000/api/endpoints \
|
#sudo -u portainer http --form POST :9000/api/endpoints \
|
||||||
#"Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6MSwidXNlcm5hbWUiOiJwb3J0YWluZXIiLCJyb2xlIjoxLCJleHAiOjE2MjU2MzUxNzB9.RF6-DxP_HAdRwkpi3fPTr7YPjzTBsaioi9Au3njY0YI" \
|
#"Authorization: Bearer $jwt" \
|
||||||
#Name="kubernetes" URL="tcp://10.0.2.8:9001" EndpointCreationType=2
|
#Name="kubernetes" URL="tcp://10.0.2.8:30778" EndpointCreationType=2 TLS="true" TLSSkipVerify="true" TLSSkipClientVerify="true"
|
||||||
|
81
portainer-agent-k8s.yaml
Normal file
81
portainer-agent-k8s.yaml
Normal file
@ -0,0 +1,81 @@
|
|||||||
|
apiVersion: v1
|
||||||
|
kind: Namespace
|
||||||
|
metadata:
|
||||||
|
name: portainer
|
||||||
|
---
|
||||||
|
apiVersion: v1
|
||||||
|
kind: ServiceAccount
|
||||||
|
metadata:
|
||||||
|
name: portainer-sa-clusteradmin
|
||||||
|
namespace: portainer
|
||||||
|
---
|
||||||
|
apiVersion: rbac.authorization.k8s.io/v1
|
||||||
|
kind: ClusterRoleBinding
|
||||||
|
metadata:
|
||||||
|
name: portainer-crb-clusteradmin
|
||||||
|
roleRef:
|
||||||
|
apiGroup: rbac.authorization.k8s.io
|
||||||
|
kind: ClusterRole
|
||||||
|
name: cluster-admin
|
||||||
|
subjects:
|
||||||
|
- kind: ServiceAccount
|
||||||
|
name: portainer-sa-clusteradmin
|
||||||
|
namespace: portainer
|
||||||
|
---
|
||||||
|
apiVersion: v1
|
||||||
|
kind: Service
|
||||||
|
metadata:
|
||||||
|
name: portainer-agent
|
||||||
|
namespace: portainer
|
||||||
|
spec:
|
||||||
|
type: NodePort
|
||||||
|
selector:
|
||||||
|
app: portainer-agent
|
||||||
|
ports:
|
||||||
|
- name: http
|
||||||
|
protocol: TCP
|
||||||
|
port: 9001
|
||||||
|
targetPort: 9001
|
||||||
|
nodePort: 30778
|
||||||
|
---
|
||||||
|
apiVersion: v1
|
||||||
|
kind: Service
|
||||||
|
metadata:
|
||||||
|
name: portainer-agent-headless
|
||||||
|
namespace: portainer
|
||||||
|
spec:
|
||||||
|
clusterIP: None
|
||||||
|
selector:
|
||||||
|
app: portainer-agent
|
||||||
|
---
|
||||||
|
apiVersion: apps/v1
|
||||||
|
kind: Deployment
|
||||||
|
metadata:
|
||||||
|
name: portainer-agent
|
||||||
|
namespace: portainer
|
||||||
|
spec:
|
||||||
|
selector:
|
||||||
|
matchLabels:
|
||||||
|
app: portainer-agent
|
||||||
|
template:
|
||||||
|
metadata:
|
||||||
|
labels:
|
||||||
|
app: portainer-agent
|
||||||
|
spec:
|
||||||
|
serviceAccountName: portainer-sa-clusteradmin
|
||||||
|
containers:
|
||||||
|
- name: portainer-agent
|
||||||
|
image: portainer/agent:latest
|
||||||
|
imagePullPolicy: Always
|
||||||
|
env:
|
||||||
|
- name: LOG_LEVEL
|
||||||
|
value: DEBUG
|
||||||
|
- name: AGENT_CLUSTER_ADDR
|
||||||
|
value: "portainer-agent-headless"
|
||||||
|
- name: KUBERNETES_POD_IP
|
||||||
|
valueFrom:
|
||||||
|
fieldRef:
|
||||||
|
fieldPath: status.podIP
|
||||||
|
ports:
|
||||||
|
- containerPort: 9001
|
||||||
|
protocol: TCP
|
Loading…
Reference in New Issue
Block a user