Commit c9dcd2f6 authored by Larkin Heintzman's avatar Larkin Heintzman

updates to readme

parent 55f03fe3
......@@ -63,6 +63,9 @@ There are a number of non-intuitive kubernetes commands that are super helpful f
- regenerate token join command: `kubeadm token create --print-join-command`
- add pod cidr to remote nodes, sometimes this is required depending on which interface is used to add a node: `kubectl patch node <NODE_NAME> -p '{"spec":{"podCIDR":"<SUBNET>"}}'` from this really niche [github page][podcidr-help]
`
## Links With More Information
Debugging clusters can be somewhat difficult as everything is stuffed into pods, the links below have some steps to try:
......@@ -71,6 +74,7 @@ Debugging clusters can be somewhat difficult as everything is stuffed into pods,
- general steps for building images with buildx [here][docker-buildx]
- there's some specific steps that got ARM64 builds working in my case, solution [here][docker-buildx-platform]
[podcidr-help]: https://github.com/flannel-io/flannel/blob/master/Documentation/troubleshooting.md
[crashloop]: https://managedkube.com/kubernetes/pod/failure/crashloopbackoff/k8sbot/troubleshooting/2019/02/12/pod-failure-crashloopbackoff.html
[docker-buildx]: https://collabnix.com/building-arm-based-docker-images-on-docker-desktop-made-possible-using-buildx/
[docker-buildx-platform]: https://github.com/docker/buildx/issues/464
......@@ -3,10 +3,34 @@
# script that starts up kubernetes cluster, and does some basic qol
swapoff -a # turn off swap memory
kubeadm init --config kubeadm-config.yml
sudo swapoff -a # turn off swap memory
sudo kubeadm init --config kubeadm-config.yaml
mkdir -p ~/.kube
sudo cp -i /etc/kubernetes/admin.conf $HOME/.kube/config
sudo chown $(id -u):$(id -g) $HOME/.kube/config
#tbd
if [[ $? -ne 0 ]] ; then
# some error
echo "Error! Stopping cluster set up"
exit 1
fi
mkdir -p $HOME/.kube
sudo cp -f /etc/kubernetes/admin.conf $HOME/.kube/config
chown $(id -u):$(id -g) $HOME/.kube/config
# export KUBECONFIG=/etc/kubernetes/admin.conf
kubectl apply -f flannel.yml
kubectl taint nodes --all node-role.kubernetes.io/master-
kubectl label nodes $HOSTNAME name=master
# print join command again to clipboard
# kubeadm token create --print-join-command > ./tmpJoinCommand.txt
# now add config command to file
kubeadm token create --print-join-command | xclip -selection clipboard
# save that file to clipboard
# cat ./tmpJoinCommand.txt | xclip -selection clipboard
# rm ./tmpJoinCommand.txt
echo "set up done, join command copied (can ctrl-c now)"
exit 0
# dang pod cidr decided not to be assigned correctly, so follow links to assign it manually:
# https://stackoverflow.com/questions/52633215/kubernetes-worker-nodes-not-automatically-being-assigned-podcidr-on-kubeadm-join
ARG from=ros:noetic
FROM ${from}
RUN apt-get update && apt-get install -y python3-pip git ca-certificates
RUN apt-get update && apt-get install -y libsdl2-dev libusb-1.0-0-dev build-essential cmake && apt-get install -y openssh-server
RUN pip3 install git+https://github.com/catkin/catkin_tools.git
# clone ros package repo
ENV ROS_WS /opt/ros_ws
RUN mkdir -p $ROS_WS/src
WORKDIR $ROS_WS
RUN git -C src clone https://git.caslab.ece.vt.edu/hlarkin3/base-station-ros/
# install ros package dependencies
RUN apt-get update && \
rosdep update && \
rosdep install -y --from-paths src/* --ignore-src && \
rm -rf /var/lib/apt/lists/*
# build ros package source
RUN catkin config \
--extend /opt/ros/$ROS_DISTRO && \
catkin build --cmake-args -DCMAKE_CXX_FLAGS="-std=c++17"
# \
# roscpp_tutorials
# might need something different in the bash script
# COPY bashCheckRoscore.sh /usr/local/bin/bashCheckRoscore.sh
COPY ros_entrypoint.sh /usr/local/bin/ros_entrypoint.sh
RUN useradd -m -s /bin/bash -p $(openssl passwd -1 password) webssh
RUN chmod 755 /usr/local/bin/ros_entrypoint.sh && \
/usr/local/bin/ros_entrypoint.sh
# make ssh-ing easier
RUN echo "source /opt/ros/noetic/setup.bash" >> /home/webssh/.bashrc
RUN echo "source /opt/ros_ws/devel/setup.bash" >> /home/webssh/.bashrc
ENTRYPOINT ["/usr/local/bin/ros_entrypoint.sh"]
CMD ["bash"]
# CMD ["service ssh start"]
# run ros package launch file
# CMD ["roslaunch", "roscpp_tutorials", "talker_listener.launch"]
#!/bin/bash
set -e
echo "==> Executing node image entrypoint ..."
# setup ros environment
source "/opt/ros/$ROS_DISTRO/setup.bash"
# might need to source the devel space as well
source "$ROS_WS/devel/setup.bash"
service ssh start
echo "==> Container ready"
exec "$@"
ARG from=ros:noetic
FROM ${from}
# install build tools
# RUN apt-get update && apt-get install -y \
# python-catkin-tools \
# && rm -rf /var/lib/apt/lists/*
RUN apt-get update && apt-get install -y python3-pip git
# work around as the apt-get version fails
RUN pip3 install git+https://github.com/catkin/catkin_tools.git
......
......@@ -62,7 +62,7 @@ sudo kubeadm reset
reset ipv6 tables and such (seems to work fine without but eh):
iptables -F && iptables -t nat -F && iptables -t mangle -F && iptables -X
sudo iptables -F && sudo iptables -t nat -F && sudo iptables -t mangle -F && sudo iptables -X
another ipvs reset:
......@@ -108,3 +108,5 @@ crashloop backoff evaluation steps: https://managedkube.com/kubernetes/pod/failu
docker buildx, building for multiple architectures: https://collabnix.com/building-arm-based-docker-images-on-docker-desktop-made-possible-using-buildx/
buildx platform error thingy: https://github.com/docker/buildx/issues/464
kubeadm join 192.168.1.230:6443 --token mv91uq.jxbm5k6yvog9tuh8 --discovery-token-ca-cert-hash sha256:2cb08cfa15611c1bdf6ab3a387145fa9cf092b59fb1c9134a51a625ab72325e3 --config kubeadm-config.yaml
apiVersion: apps/v1
kind: Deployment
metadata:
name: base-deployment
labels:
app: llhcluster
node: base
spec:
replicas: 1
# The deployment handles all matching templated pods
selector:
matchLabels:
node: base
# Template for a replica.
# The deployment makes sure that a POD containing the containers
# defined below is always running.
template:
metadata:
labels:
node: base
spec:
containers:
- name: base
image: llh/basestation:v0
args:
- roscore
ports:
- containerPort: 11311
name: baseport
nodeSelector:
name: master
---
apiVersion: v1
kind: Service
metadata:
name: service-master
labels:
app: llhcluster
node: base
spec:
clusterIP: None
ports:
- port: 11311
selector:
node: base
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment