updates
This commit is contained in:
parent
20bf335c85
commit
b6183f70e2
@ -1,35 +1,64 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
#
|
#
|
||||||
# verified on Fedora 31 WS
|
# verified on Fedora 31 and Ubuntu LTS 20.04
|
||||||
|
|
||||||
|
echo this script works on Fedora 31 and Ubuntu 20.04
|
||||||
|
echo it does NOT currently work on Fedora 32
|
||||||
|
echo it requires the machine where you run it to have 6GB of RAM or more
|
||||||
|
echo press Enter to continue
|
||||||
|
read
|
||||||
|
|
||||||
|
# setting MYOS variable
|
||||||
|
MYOS=$(hostnamectl | awk '/Operating/ { print $3 }')
|
||||||
|
OSVERSION=$(hostnamectl | awk '/Operating/ { print $4 }')
|
||||||
|
|
||||||
egrep '^flags.*(vmx|svm)' /proc/cpuinfo || (echo enable CPU virtualization support and try again && exit 9)
|
egrep '^flags.*(vmx|svm)' /proc/cpuinfo || (echo enable CPU virtualization support and try again && exit 9)
|
||||||
|
|
||||||
dnf clean all
|
# debug MYOS variable
|
||||||
dnf -y upgrade
|
echo MYOS is set to $MYOS
|
||||||
|
|
||||||
# install KVM software
|
#### Fedora config
|
||||||
dnf install @virtualization -y
|
if [ $MYOS = "Fedora" ]
|
||||||
systemctl enable --now libvirtd
|
then
|
||||||
|
#if [ $OSVERSION = 32 ]
|
||||||
|
#then
|
||||||
|
# echo Fedora 32 is not currently supported
|
||||||
|
# exit 9
|
||||||
|
#fi
|
||||||
|
|
||||||
|
sudo dnf clean all
|
||||||
|
sudo dnf -y upgrade
|
||||||
|
|
||||||
|
# install KVM software
|
||||||
|
sudo dnf install @virtualization -y
|
||||||
|
sudo systemctl enable --now libvirtd
|
||||||
|
sudo usermod -aG libvirt `id -un`
|
||||||
|
fi
|
||||||
|
|
||||||
|
### Ubuntu config
|
||||||
|
if [ $MYOS = "Ubuntu" ]
|
||||||
|
then
|
||||||
|
sudo apt-get update -y
|
||||||
|
sudo apt-get install -y apt-transport-https curl
|
||||||
|
sudo apt-get upgrade -y
|
||||||
|
sudo apt-get install -y qemu-kvm libvirt-daemon-system libvirt-clients bridge-utils
|
||||||
|
|
||||||
|
sudo adduser `id -un` libvirt
|
||||||
|
sudo adduser `id -un` kvm
|
||||||
|
fi
|
||||||
|
|
||||||
# install kubectl
|
# install kubectl
|
||||||
echo installing kubectl
|
curl -LO https://storage.googleapis.com/kubernetes-release/release/`curl -s https://storage.googleapis.com/kubernetes-release/release/stable.txt`/bin/linux/amd64/kubectl
|
||||||
cat <<EOF > /etc/yum.repos.d/kubernetes.repo
|
chmod +x ./kubectl
|
||||||
[kubernetes]
|
sudo mv ./kubectl /usr/local/bin/kubectl
|
||||||
name=Kubernetes
|
|
||||||
baseurl=https://packages.cloud.google.com/yum/repos/kubernetes-el7-x86_64
|
|
||||||
enabled=1
|
|
||||||
gpgcheck=1
|
|
||||||
repo_gpgcheck=1
|
|
||||||
gpgkey=https://packages.cloud.google.com/yum/doc/yum-key.gpg https://packages.cloud.google.com/yum/doc/rpm-package-key.gpg
|
|
||||||
EOF
|
|
||||||
|
|
||||||
dnf install -y kubectl
|
|
||||||
|
|
||||||
# install minikube
|
# install minikube
|
||||||
echo downloading minikube, check version
|
echo downloading minikube, check version
|
||||||
curl -Lo minikube https://storage.googleapis.com/minikube/releases/latest/minikube-linux-amd64
|
curl -Lo minikube https://storage.googleapis.com/minikube/releases/latest/minikube-linux-amd64
|
||||||
|
|
||||||
chmod +x minikube
|
sudo chmod +x minikube
|
||||||
mv minikube /usr/local/bin
|
sudo mv minikube /usr/local/bin
|
||||||
|
|
||||||
|
# start minikube
|
||||||
|
minikube start --memory 4096 --vm-driver=kvm2
|
||||||
|
|
||||||
echo at this point, reboot your Fedora Workstation. After reboot, manually run as non-root
|
|
||||||
echo minikube start --memory 4096 --vm-driver=kvm2
|
|
||||||
|
|||||||
20
nginx-cm.yml
Normal file
20
nginx-cm.yml
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
apiVersion: v1
|
||||||
|
kind: Pod
|
||||||
|
metadata:
|
||||||
|
name: nginx-cm
|
||||||
|
labels:
|
||||||
|
role: web
|
||||||
|
spec:
|
||||||
|
containers:
|
||||||
|
- name: nginx-cm
|
||||||
|
image: nginx
|
||||||
|
volumeMounts:
|
||||||
|
- name: conf
|
||||||
|
mountPath: /etc/nginx/conf.d
|
||||||
|
volumes:
|
||||||
|
- name: conf
|
||||||
|
configMap:
|
||||||
|
name: nginx-cm
|
||||||
|
items:
|
||||||
|
- key: nginx-custom-config.conf
|
||||||
|
path: default.conf
|
||||||
8
nginx-custom-config.conf
Normal file
8
nginx-custom-config.conf
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
server {
|
||||||
|
listen 8888;
|
||||||
|
server_name localhost;
|
||||||
|
location / {
|
||||||
|
root /usr/share/nginx/html;
|
||||||
|
index index.html index.htm;
|
||||||
|
}
|
||||||
|
}
|
||||||
15
test-cm-pod.yaml
Normal file
15
test-cm-pod.yaml
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
apiVersion: v1
|
||||||
|
kind: Pod
|
||||||
|
metadata:
|
||||||
|
name: test-pod
|
||||||
|
spec:
|
||||||
|
containers:
|
||||||
|
- name: test
|
||||||
|
image: nginx
|
||||||
|
env:
|
||||||
|
- name: COLOR
|
||||||
|
valueFrom:
|
||||||
|
configMapKeyRef:
|
||||||
|
name: myconfig
|
||||||
|
key: color
|
||||||
|
restartPolicy: Never
|
||||||
Loading…
Reference in New Issue
Block a user