Kubernetes the Hardway installation
- The state as of now is we are able to run the etcd from commandline as root user
/usr/local/bin/etcd \
--name ip-172-31-51-202 \
--cert-file=/etc/etcd/kubernetes.pem \
--key-file=/etc/etcd/kubernetes-key.pem \
--peer-cert-file=/etc/etcd/kubernetes.pem \
--peer-key-file=/etc/etcd/kubernetes-key.pem \
--trusted-ca-file=/etc/etcd/ca.pem \
--peer-trusted-ca-file=/etc/etcd/ca.pem \
--peer-client-cert-auth \
--client-cert-auth \
--initial-advertise-peer-urls https://172.31.51.202:2380 \
--listen-peer-urls https://172.31.51.202:2380 \
--listen-client-urls https://172.31.51.202:2379,https://127.0.0.1:2379 \
--advertise-client-urls https://172.31.51.202:2379 \
--initial-cluster-token etcd-cluster-0 \
--initial-cluster controller-0=https://10.240.0.10:2380,controller-1=https://10.240.0.11:2380,controller-2=https://10.240.0.12:2380 \
--initial-cluster-state new
- But running as service is not working out
[Unit]
Description=etcd
Documentation=https://github.com/coreos
[Service]
Type=notify
ExecStart=/usr/local/bin/etcd \
--name ip-172-31-51-202 \
--cert-file=/etc/etcd/kubernetes.pem \
--key-file=/etc/etcd/kubernetes-key.pem \
--peer-cert-file=/etc/etcd/kubernetes.pem \
--peer-key-file=/etc/etcd/kubernetes-key.pem \
--trusted-ca-file=/etc/etcd/ca.pem \
--peer-trusted-ca-file=/etc/etcd/ca.pem \
--peer-client-cert-auth \
--client-cert-auth \
--initial-advertise-peer-urls https://172.31.51.202:2380 \
--listen-peer-urls https://172.31.51.202:2380 \
--listen-client-urls https://172.31.51.202:2379,https://127.0.0.1:2379 \
--advertise-client-urls https://172.31.51.202:2379 \
--initial-cluster-token etcd-cluster-0 \
--initial-cluster controller-0=https://10.240.0.10:2380,controller-1=https://10.240.0.11:2380,controller-2=https://10.240.0.12:2380 \
--initial-cluster-state new
Restart=on-failure
RestartSec=5
[Install]
WantedBy=multi-user.target
Kubernetes Primitives – Pod
- The smallest unit of creation for
- Hypervisor is Virtual Machine
- Docker is Container
- K8s is Pod

- Pod can have one or more container(s) in it.
- Recommended practice of k8s recommends running a microservice in a Pod and databases in different pods
- Scaling Application in k8s is increasing number of Pods not number of containers in a Pod

- Kubernetes maintains desired state
- For some of the explorations in terms of primitives
- Create a simple pod with any image
kubectl create nginx --image=nginx
# to login into nginx
kubectl exec -it nginx -- /bin/bash
# install net-tools
apt update && apt install net-tools
ifconfig
# two network interfaces `lo` and `etho` (with pod ip)
exit
- Create an alpine pod with
sleep 1d
as argument with kubectl run imperative commands
- Refer Here for kubectl cheatsheet
Like this:
Like Loading...