Create kubernetes_dashboard_setup.sh
This commit is contained in:
		
							
								
								
									
										23
									
								
								deploy/kubernetes_dashboard_setup.sh
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										23
									
								
								deploy/kubernetes_dashboard_setup.sh
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,23 @@
 | 
			
		||||
#!/bin/bash
 | 
			
		||||
 | 
			
		||||
#Gen certificates
 | 
			
		||||
mkdir -p certs
 | 
			
		||||
cd certs
 | 
			
		||||
CERT_DIR=$PWD
 | 
			
		||||
openssl genrsa -des3 -passout pass:x -out dashboard.pass.key 2048
 | 
			
		||||
openssl rsa -passin pass:x -in dashboard.pass.key -out dashboard.key
 | 
			
		||||
rm dashboard.pass.key
 | 
			
		||||
openssl req -new -key dashboard.key -out dashboard.csr -subj "/C=US/ST=Denial/L=Springfield/O=Dis/CN=www.example.com"
 | 
			
		||||
openssl x509 -req -sha256 -days 365 -in dashboard.csr -signkey dashboard.key -out dashboard.crt
 | 
			
		||||
kubectl create secret generic kubernetes-dashboard-certs --from-file=$CERT_DIR -n kube-system
 | 
			
		||||
cd ..
 | 
			
		||||
 | 
			
		||||
#Deploy the dashboard
 | 
			
		||||
#wget https://raw.githubusercontent.com/kubernetes/dashboard/master/src/deploy/recommended/kubernetes-dashboard.yaml
 | 
			
		||||
wget https://raw.githubusercontent.com/kubernetes/dashboard/master/aio/deploy/recommended/kubernetes-dashboard.yaml
 | 
			
		||||
sed -i '176i\  type: LoadBalancer' kubernetes-dashboard.yaml
 | 
			
		||||
kubectl apply -f kubernetes-dashboard.yaml
 | 
			
		||||
 | 
			
		||||
#Token based dashboard authentication
 | 
			
		||||
kubectl create serviceaccount k8sadmin -n kube-system
 | 
			
		||||
kubectl create clusterrolebinding k8sadmin --clusterrole=cluster-admin --serviceaccount=kube-system:k8sadmin
 | 
			
		||||
		Reference in New Issue
	
	Block a user