updates
This commit is contained in:
parent
20bf335c85
commit
b6183f70e2
@ -1,35 +1,64 @@
|
||||
#!/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)
|
||||
|
||||
dnf clean all
|
||||
dnf -y upgrade
|
||||
# debug MYOS variable
|
||||
echo MYOS is set to $MYOS
|
||||
|
||||
# install KVM software
|
||||
dnf install @virtualization -y
|
||||
systemctl enable --now libvirtd
|
||||
#### Fedora config
|
||||
if [ $MYOS = "Fedora" ]
|
||||
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
|
||||
echo installing kubectl
|
||||
cat <<EOF > /etc/yum.repos.d/kubernetes.repo
|
||||
[kubernetes]
|
||||
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
|
||||
curl -LO https://storage.googleapis.com/kubernetes-release/release/`curl -s https://storage.googleapis.com/kubernetes-release/release/stable.txt`/bin/linux/amd64/kubectl
|
||||
chmod +x ./kubectl
|
||||
sudo mv ./kubectl /usr/local/bin/kubectl
|
||||
|
||||
# install minikube
|
||||
echo downloading minikube, check version
|
||||
curl -Lo minikube https://storage.googleapis.com/minikube/releases/latest/minikube-linux-amd64
|
||||
|
||||
chmod +x minikube
|
||||
mv minikube /usr/local/bin
|
||||
sudo chmod +x minikube
|
||||
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