Kubernetes (1.17)

Installing

Mac

brew install kubernetes-cli

Linux

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
# create a kubeconfig.yaml file (by downloading it or whatever) and export it
export KUBECONFIG=kubeconfig.yaml

Usage

Example of a Deployment yaml file to deploy 3 pods with nginx image and expose port 80

    apiVersion: apps/v1
    kind: Deployment
    metadata:
        name: myNginx
    spec:
        replicas: 3
        selector:
            matchLabels:
                app: myNginx
        template:
            metadata:
                labels:
                    app: myNginx
            spec:
                containers:
                - name: myNginx
                    image: nginx
                    ports:
                        - containerPort: 80

Exposing our service to the outside world

Other way to export our service, make a service yaml file

    apiVersion: v1
    kind: Service
    metadata:
        name: myNginx
        labels:
            app: myNginx
    spec:
        type: LoadBalancer
        ports:
            - port: 80
        selector:
            app: myNginx