Ingress Controller is a pre-requisite for this exercise. There is only one Ingress-controller for KOPS available on Github. https://github.com/kubernetes/ingress-nginx
I will create another post once I create the Ingress-Controller
$ kubectl create -f https://k8s.io/docs/tasks/access-application-cluster/hello.yaml
deployment "hello" created
$ kubectl get deploy
NAME DESIRED CURRENT UP-TO-DATE AVAILABLE AGE
hello 7 7 7 6 9s
$
$ kubectl get nodes
NAME STATUS ROLES AGE VERSION
host01 Ready
$ kubectl get pods
NAME READY STATUS RESTARTS AGE
hello-f95d44d75-4d6g5 1/1 Running 0 1m
hello-f95d44d75-522kj 1/1 Running 0 1m
hello-f95d44d75-5w4jt 1/1 Running 0 1m
hello-f95d44d75-8tzr7 1/1 Running 0 1m
hello-f95d44d75-m6znh 1/1 Running 0 1m
hello-f95d44d75-s4br5 1/1 Running 0 1m
hello-f95d44d75-tzccb 1/1 Running 0 1m
$ w
19:22:59 up 6 min, 1 user, load average: 0.16, 0.15, 0.06
USER TTY FROM LOGIN@ IDLE JCPU PCPU WHAT
root pts/0 172.17.0.52 19:18 0.00s 0.08s 0.00s w
$ netstat -ntlp
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0 0 127.0.0.1:10248 0.0.0.0:* LISTEN 1886/localkube
tcp 0 0 127.0.0.1:2379 0.0.0.0:* LISTEN 1886/localkube
tcp 0 0 127.0.0.1:2380 0.0.0.0:* LISTEN 1886/localkube
tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 674/sshd
tcp6 0 0 :::8443 :::* LISTEN 1886/localkube
tcp6 0 0 :::4194 :::* LISTEN 1886/localkube
tcp6 0 0 :::10250 :::* LISTEN 1886/localkube
tcp6 0 0 :::10251 :::* LISTEN 1886/localkube
tcp6 0 0 :::10252 :::* LISTEN 1886/localkube
tcp6 0 0 :::10255 :::* LISTEN 1886/localkube
tcp6 0 0 :::30000 :::* LISTEN 1886/localkube
tcp6 0 0 :::22 :::* LISTEN 674/sshd
$
$ kubectl describe deploy hello
Name: hello
Namespace: default
CreationTimestamp: Fri, 13 Apr 2018 19:20:16 +0000
Labels: app=hello
tier=backend
track=stable
Annotations: deployment.kubernetes.io/revision=1
Selector: app=hello,tier=backend,track=stable
Replicas: 7 desired | 7 updated | 7 total | 7 available | 0 unavailable
StrategyType: RollingUpdate
MinReadySeconds: 0
RollingUpdateStrategy: 25% max unavailable, 25% max surge
Pod Template:
Labels: app=hello
tier=backend
track=stable
Containers:
hello:
Image: gcr.io/google-samples/hello-go-gke:1.0
Port: 80/TCP
Environment:
Mounts:
Volumes:
Conditions:
Type Status Reason
---- ------ ------
Available True MinimumReplicasAvailable
Progressing True NewReplicaSetAvailable
OldReplicaSets:
NewReplicaSet: hello-f95d44d75 (7/7 replicas created)
Events:
Type Reason Age From Message
---- ------ ---- ---- -------
Normal ScalingReplicaSet 4m deployment-controller Scaled up replica set hello-f95d44d75 to 7
$ kubectl get service
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
kubernetes ClusterIP 10.96.0.1
$ kubectl create -f https://k8s.io/docs/tasks/access-application-cluster/hello-service.yaml
service "hello" created
$ kubectl create -f https://k8s.io/docs/tasks/access-application-cluster/hello-service.yaml
service "hello" created
$
$
$ kubectl get service
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
hello ClusterIP 10.111.253.211
kubernetes ClusterIP 10.96.0.1
$
$ kubectl describe service hello
Name: hello
Namespace: default
Labels:
Annotations:
Selector: app=hello,tier=backend
Type: ClusterIP
IP: 10.111.253.211
Port:
TargetPort: http/TCP
Endpoints: 172.18.0.10:80,172.18.0.4:80,172.18.0.5:80 + 4 more...
Session Affinity: None
Events:
$
$ vi ingress.yaml
$
apiVersion: extensions/v1beta1
kind: Ingress
metadata:
name: test-ingress
spec:
backend:
serviceName: hello
servicePort: 80
$ kubectl create -f ingress.yaml
ingress "test-ingress" created
$
$ kubectl get ingress
NAME HOSTS ADDRESS PORTS AGE
test-ingress * 80 26s
$ kubectl get ingress
NAME HOSTS ADDRESS PORTS AGE
test-ingress * 80 28s
$ kubectl describe ingress test-ingress
Name: test-ingress
Namespace: default
Address:
Default backend: hello:80 (172.18.0.10:80,172.18.0.4:80,172.18.0.5:80 + 4 more...)
Rules:
Host Path Backends
---- ---- --------
* * hello:80 (172.18.0.10:80,172.18.0.4:80,172.18.0.5:80 + 4 more...)
Annotations:
Events:
$ kubectl get ingress
NAME HOSTS ADDRESS PORTS AGE
test-ingress * 80 2m
$ kubectl get ingress
NAME HOSTS ADDRESS PORTS AGE
test-ingress * 80 2m
$
$
No comments:
Post a Comment